Determine if GIF is animated

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
goldfinger

Determine if GIF is animated

Post by goldfinger »

Hi,

I need help with a command line to determine whether a .gif image is animated.
I found a solution on the web "identify -format" and if frames > 1 it's animated.
But for some reason this command didn't recognize all animated gifs, especially
"glitter" gifs were skipped.


Would appreciate your help here.

Thanks,
Avi
sevasjack

Re: Determine if GIF is animated

Post by sevasjack »

I have used

Code: Select all

identify -format "%n" image.gif
%n - number of scenes, if more than 1 (one) then its animated 100%! ;)
goldfinger

Re: Determine if GIF is animated

Post by goldfinger »

sevasjack wrote:I have used

Code: Select all

identify -format "%n" image.gif
%n - number of scenes, if more than 1 (one) then its animated 100%! ;)
This is exactly what I tried, but it skipped many... uhmmm...
I'll try it again. Thanks :)
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Determine if GIF is animated

Post by anthony »

Are you sure those images were animated. ALL animationed images must have two or more frames. It is there nature.

If you have an example of a animation that it 'skipped' can you port a URL to it?

Glitter is something that I have been meaning to add to IM examples. though there are about a half a dozen ways you can add glitter. Most of them maskes the stars to the area being glittered, making them look 'unreal'.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
goldfinger

Re: Determine if GIF is animated

Post by goldfinger »

I tried this again, and everything worked just fine.
I suppose I must have made a mistake with the code in the first try.

Thank you :)
Post Reply