decomposing an animated gif

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
leyn
Posts: 8
Joined: 2011-11-09T02:45:30-07:00
Authentication code: 8675308

decomposing an animated gif

Post by leyn »

Hello,

I have an animated gif.
2 questions:
1) how do I extract the composing images out of that animated gif?
2) how do I ask up the number of images, and the display time of
each composing image and/or the total time?

Best regards,

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

Re: decomposing an animated gif

Post by fmw42 »

You can only get the frames and not the composing image if there are more than one image in a frame.

try

convert animation.gif +adjoin animation_%d.gif

+adjoin is not needed if the image type does not support multi-frames. So gif and tif need it, but png and jpg do not.

http://www.imagemagick.org/script/comma ... php#adjoin

To get information about each frame

identify -verbose animation.gif
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: decomposing an animated gif

Post by anthony »

For details of methods to extract information from GIF animations see
IM examples, Animation Basics, Studying Animations
http://www.imagemagick.org/Usage/anim_basics/#study

There are a lot of 'percent' formatting escapes that can be used to extract exactly the information you want from an identify. Also given are some scripts that can 'decompose' the animation to separate frame images, plus a 'script' that can be used to put those frames back together again!

I use those scripts later in Animation Modifications, such as Appending Side-by-Side
http://www.imagemagick.org/Usage/anim_mods/#append
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply