So I've this:
exec("cd $upload_directory && convert \\( +append -limit memory 1 -limit map 1 *.jpg \\) -strip -trim -interlace Plane -quality 60 output.jpg
The workflow is:
Now the problems is with making the large sprite. It consumes 100% CPU (according to top
on the server), it fails when there are many images. Also the process outputs Killed
without any further error message.
Now, I'm sure I can solve this by throwing more muscle on the server, but I'm having the feeling that the one I have isn't the most efficient.
What can I try to mitigate the problem?
You kind-of answered your own question. You are doing something really intensive. The expected outcome is that CPU usage will shoot-up. Unzipping takes memory and cpu. Creating massive images takes IO, CPU, and Memory. If you ever used Photoshop, youll notice that your systems memory and cpu always shoots-up. Dealing with images is no simple task.
If you want to handle large images using the current method, then you need a stronger server. There is no magic parameter that will make the process use less memory. If you have a 32MB image, its going to take a lot of memory to read it before you can even try to reduce its size.
Hope that helps!