Page 2 of 2

Re: ImageMagick tries to handle all frames of an animated GIF

Posted: 2017-12-30T09:24:27-07:00
by RandomTroll
Getting 1 pixel from each image made no difference: IM still made an 8MB temp file for each frame.

I run it with no other apps running. top reports it using 2-2.4 GB RAM, 64-80% - not all. 149 frames, 8 MB each: that's 1.2 GB: why does IM cache to disk?

Re: ImageMagick tries to handle all frames of an animated GIF

Posted: 2017-12-30T11:13:06-07:00
by fmw42
You need enough room for the input and the output in RAM and any temp files that may be created. So I suspect you are running out of RAM.

Re: ImageMagick tries to handle all frames of an animated GIF

Posted: 2017-12-30T13:56:44-07:00
by RandomTroll
python-pillow's explode.py extracts individual frames in a jiffy; gifbuild returns a count quickly. I've solved my problem but not answered my question.

Re: ImageMagick tries to handle all frames of an animated GIF

Posted: 2017-12-30T13:58:08-07:00
by RandomTroll
fmw42 wrote:
2017-12-30T11:13:06-07:00
You need enough room for the input and the output in RAM and any temp files that may be created. So I suspect you are running out of RAM.
You can suspect that, but it's inconsistent with observation.

Re: ImageMagick tries to handle all frames of an animated GIF

Posted: 2017-12-30T14:35:22-07:00
by snibgo
RandomTroll wrote:... why does IM cache to disk?
From what you've said, I can only think that the O/S is denying the memory requests. Have you tried "-debug all"?

Re: ImageMagick tries to handle all frames of an animated GIF

Posted: 2017-12-30T14:42:41-07:00
by RandomTroll
snibgo wrote:
2017-12-30T14:35:22-07:00
RandomTroll wrote:... why does IM cache to disk?
From what you've said, I can only think that the O/S is denying the memory requests. Have you tried "-debug all"?
top reports that it's getting 2-2.4GB of RAM and there's still .6GB free. That should easily be enough to hold a 7MB input file and 149 8MB output files. I occasionally run other apps that use all my RAM.

There's a more important question: why does IM have to render every frame just to count them? to extract a single one? Even if it does it all in RAM, it's a waste.

Re: ImageMagick tries to handle all frames of an animated GIF

Posted: 2017-12-30T16:33:00-07:00
by fmw42
I don't know if this helps, but to get the number of frames, you can do (on Unix)

Code: Select all

convert rose: rose: rose: rose.gif

Code: Select all

identify -ping -format "%n\n" rose.gif | head -n 1
3
The -ping avoids reading the pixel data and just reads from the header, if the information is in the header.