Page 1 of 1
Image which has multiple frames
Posted: 2007-10-31T04:58:18-07:00
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.
Re: Image which has multiple frames
Posted: 2007-11-15T08:44:50-07:00
by seanburke1979
identify -format "%[fx:n]" myfile.gif
Re: Image which has multiple frames
Posted: 2007-11-15T08:59:31-07:00
by eldiener
seanburke1979 wrote:identify -format "%[fx:n]" myfile.gif
My OP said programatically. You have given me a command line.
Re: Image which has multiple frames
Posted: 2007-11-15T09:25:53-07:00
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
Re: Image which has multiple frames
Posted: 2007-11-15T09:46:06-07:00
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.