ImageMagick identify reports incorrect GIF frame count

953 views Asked by At

I'm using ImageMagick to do some stuff with GIF images.

One of my steps is identifying the number of frames in an image.
I'm calling identify via node-imagemagick (and later gm) like this:

identify -format '%T,%w,%h ' test.gif

Most of the time I correctly get 53 space-separated values for 53 frames.
But sometimes I get 47 or 50 frames for the same GIF image (that has 53 frames).

How can this possibly happen?

I'm running convert -coalesce -append test.gif other.gif at the same time, but it shouldn't touch the original image, right? Moreover I checked and the original image is just fine, even when wrong number of frames is reported.

I can't even reproduce this consistently. Where do I look for the problem?

This seems to happen when I'm running several ImageMagick processes concurrently (on different files).

I'm using ImageMagick 6.8.7-9 Q16 x86_64 2013-12-11.

The image in question:

(But I've had this happen to other images.)

1

There are 1 answers

0
Dan Abramov On BEST ANSWER

This was not an ImageMagick problem at all.
My code for downloading the image to the server was faulty, always skipping some last fifty bytes or so.

This was too easy to miss because it didn't impact GIF's quality severely.