Answer the question
In order to leave comments, you need to log in
GIF Frame Counting
How to count the number of frames (images) in a gif animation with only the byte code of the file? I read the specification, found out that the image descriptor starts with the value 0x2C, but how to determine that this is a frame description, and not some pixel or something else?
Answer the question
In order to leave comments, you need to log in
There is no easy way, you need to read the entire file and count the frames. And in order to understand that this is exactly the beginning of the frame, and not something else, you need to read section by section. In the animated GIF, the image descriptor after the Graphic Control Extension (one per frame) is what we need to count. The algorithm is something like this:
I said the same, but in response I received "We are not looking for simple ways";)
It is enough to use the identify utility from the Imagemagick package. Parsing its output is not difficult.
www.imagemagick.org/Usage/anim_basics/#identify
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question