Image which has multiple frames

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
eldiener

Image which has multiple frames

Post by eldiener »

Is there any direct Image attribute which will tell me programtically whether a particular image consists of multiple frames or not ? I am dealing with GIF images and want to determine whether or not a GIF is a single frame image or a multi-frame GIF animation.
seanburke1979

Re: Image which has multiple frames

Post by seanburke1979 »

identify -format "%[fx:n]" myfile.gif
eldiener

Re: Image which has multiple frames

Post by eldiener »

seanburke1979 wrote:identify -format "%[fx:n]" myfile.gif
My OP said programatically. You have given me a command line.
el_supremo
Posts: 1015
Joined: 2005-03-21T21:16:57-07:00

Re: Image which has multiple frames

Post by el_supremo »

If you're using MagickWand and have read the GIF in to a wand, this will return the number of frames:

f_num = MagickGetNumberImages(m_wand);

Pete
eldiener

Re: Image which has multiple frames

Post by eldiener »

el_supremo wrote:If you're using MagickWand and have read the GIF in to a wand, this will return the number of frames:

f_num = MagickGetNumberImages(m_wand);

Pete
I am using Magick++. What I decided to do was simply to read in the image originally, using Magick++, as if it could contain frames and I could determine from this how many frames are in the image from the size of the std::vector<Image>. If it were a single frame image I could then subsequently using just the single frame Image while if it were mutiple frames I had to use std::vector<Image> to manipulate the frames.
Post Reply