Page 1 of 1

Script is finished but "convert" continues to run?

Posted: 2011-01-25T12:53:34-07:00
by dunnma
I have a process that I can run to turn PDF files into individual JPG's. The process is a PHP script that calls ImageMagick from the command line. This script has run flawlessly (and still continues to do so).

My question/problem is that I have noticed that the PHP script (and subsequent ImageMagick calls) have completed - their job is done and I can see it, but in looking at top convert continues to use triple digit memory %. Also the load steadily increases. Sometimes it consumes so much resources that it actually causes apache to lock up and the server needs to be rebooted.

What is weird though is I can refresh a webpage and see the finished product on one screen, but on my terminal on the other screen convert is still going gangbusters and the load increases (sometimes it stops around 7, but sometimes I manually kill the script when it hits 12).

I could understand the problems if convert was actually doing something, but when I am staring at the finished product and convert continue's to run for minutes later I think something else must be up.

Any ideas?

Re: Script is finished but "convert" continues to run?

Posted: 2011-01-25T13:12:43-07:00
by magick

Re: Script is finished but "convert" continues to run?

Posted: 2011-01-25T14:04:29-07:00
by dunnma
Thanks for the info...I will look at putting a -limit-memory in place. According to the resource list I have 1.5gb...I am assuming I should just set something like 10mb (most files that are processed are less than 4mb).

I guess I am still confused why convert would continue to run when the output is finished. I don't really see why limiting the resources would "stop" convert from running once it was done.

Code: Select all

exec('convert -density 300 -colorspace rgb "/path/to/pdf" -resize SIZE -quality 65 "/path/to/folder/%02d_f.jpg"');
exec('find /path/to/folder/file/ -name \'*.jpg\' -exec convert \'{}\' -thumbnail 163x250 -quality 60 -alpha on -virtual-pixel transparent -filter point \( +clone -flip -size 163x100 gradient:gray50-black -alpha off -compose CopyOpacity -composite -channel A -evaluate multiply .35 +channel \) -append +distort Perspective \'0,0,0,0 0,163,0,163 163,0,153,10 163,163,153,153\' -gravity North -crop 163x350+0+0! -background white -compose Over -flatten \'{}\'_t.jpg \;');
That is my code...do I need to put a limit on both calls?