Using Magick++ to determine if an image contains multiple frames

Magick++ is an object-oriented C++ interface to ImageMagick. Use this forum to discuss, make suggestions about, or report bugs concerning Magick++.
Post Reply
jonotrain
Posts: 12
Joined: 2015-06-07T21:20:12-07:00
Authentication code: 6789

Using Magick++ to determine if an image contains multiple frames

Post by jonotrain » 2015-06-11T20:17:07-07:00

I am using magick++ on my website to process uploaded images. I would like to be able to test if an uploaded file contains multiple frames (whether animated or still) and to process them differently depending. What is the most efficient way to perform this test? All I could think of would be:

Code: Select all

std::list<Magick::Image> images;
readImages( &images, "uploaded file" );

if (images.size()==1) {
//process as single image
}
else {
//process multiple frames
}
Is there a more efficient way?

User avatar
fmw42
Posts: 25546
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Using Magick++ to determine if an image contains multiple frames

Post by fmw42 » 2015-06-11T20:24:24-07:00

The equivalent of identify should list each frame and size, etc. Sorry I do not know Magick++.

I also move this topic to the Magick++ forum.

jonotrain
Posts: 12
Joined: 2015-06-07T21:20:12-07:00
Authentication code: 6789

Re: Using Magick++ to determine if an image contains multiple frames

Post by jonotrain » 2015-06-11T20:31:35-07:00

does an equivalent function exist for magick++? I haven't found it in the documentation.

User avatar
dlemstra
Posts: 1568
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: Using Magick++ to determine if an image contains multiple frames

Post by dlemstra » 2015-06-11T21:50:41-07:00

The code from your first post is indeed the way to do it.
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate

Post Reply