Get the Number of frames with Magick++?

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
Tonimoro

Get the Number of frames with Magick++?

Post by Tonimoro »

Hi all,

I am using Magick++ and i am looking for a easy way to get the number of frames in an animated gif for example.
it seems quite easy to do when using command line ("identity -format %n") or "MagickGetNumberImages" in MagickWand api but what about magick++?

Thanks for any suggestions.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Get the Number of frames with Magick++?

Post by magick »

To return the number of images in a sequence use:
  • list<Image> first;
    readImages( &first, "image.gif" );
The number of images is then first.size().
Tonimoro

Re: Get the Number of frames with Magick++?

Post by Tonimoro »

Thanks, it works fine !
Post Reply