Detecting animated gifs

Discussions related to graphics (2D and 3D), animation and games programming
KenDown
Posts: 327
Joined: Wed 04 Apr 2018, 06:36

Detecting animated gifs

Post by KenDown »

Richard Russell has provided an excellent little procedure for displaying animated gifs, but what I want to know is, how can I tell if a giff is animated or not? If it is, use the procedure; if not, use the imglib routine. Is there a flag in the gif file which gives the game away?

Thanks.
DDRM

Re: Detecting animated gifs

Post by DDRM »

Hi Kendall,

It looks from the Wikipedia article as though there is an indication at &30D? A quick and dirty approach to checking whether there is more than one frame might be to read the first few bytes to extract width and height, and then work out whether the length of the file is much bigger than the size of one image? You'd need to allow for the rest of the header size (palette?).

Hope that's helpful,

D