Some warnings that should be wrote in README
Hi, After hours of bug resolution I think that theses information could help others:
-
ImageMagick use a LOT of MEMORY. Don't hesitate to increase memory limit on your server, and I don't talk about 200MB but about 500MB+ ! Monitor it on you dev machine, you will see that for a large image it could take 0.5 GB of memory easily. If you don't, expect random errors like
writing EPIPEandStream yields empty buffermainly because the process would be Killed by the host. -
Set his priority to LOW, if you want to keep your server STABLE. At the begin I use this package normally, but it resulted to blocking all request to the server due to HIGH CPU usage just when one user send his photos. Even if there are no official way to set its priority to low, I don't want to limit the CPU too to keep processing fast. So I personally use the non-documented way, using
nice:
var baseImage = gm(file.buffer).[...];
baseImage._subCommand = ["nice","-n","20"].concat(baseImage._subCommand);
baseImage.toBuffer(...)
In recent node versions can simply use cross platform os.setPriority
os.setPriority(19)
All spawned children (gm or IM) will get parent node's process priority.