Page 1 of 1

Manipulating a GIF image

Posted: 2007-10-30T13:44:23-07:00
by eldiener
I have to manipulate GIF images using Magick++. I understand that a GIF image is a multiple frame image, supporting animation. Is a GIF image always multiple frames, even when it is not an animated GIF ? If a GIF image is not always multiple frames, is there a way to determine whether it is a single frame or a multiple frame image using Magick++ ? If a GIF image is just a single frame, can it then be manipulated through the Magick++ Image class rather than through the Magick++ STL classes ?

In one of the Magick++ examples it shows that a GIF image is read as a single frame image using the Image class directly while in another Magick++ example it shows a GIF image being manipulated as a std::list<Image>.

Re: Manipulating a GIF image

Posted: 2007-11-15T21:40:38-07:00
by anthony
GIF image is an animation format with both a global and individual colormaps posible. A static image GIF is the same thing except only one image is provided and all animation options is useless and generally ignored, even though they may still be present.

Of course a multi-image GIF does NOT have to be treated as an animation. It is just that usally it is. I myself have used it as a simple multi-image file format holding a table of dither and area fill patterns.
See Dithering with Symbol Patterns
http://imagemagick.org/Usage/quantize/#diy_symbols

Usally an GIF with mutliple images is an animation, so by reading or identifying the GIF animation and requests a image count in the read in image list or sequence, is a good way to determine the number of images. for example, I do this in some IM processing using...
identify -format %n image.gif
this returns the number of images in the given image file.

In Magick++ look at the loop thur image code examples to see how you can count the number of images in the one sequence.