Page 1 of 1

Re: Converting an animated gif into a 3 layered image

Posted: 2008-06-27T16:30:15-07:00
by fmw42
you can extract any layer/frame you want using the [n] syntax for frame n.

Code: Select all

convert image.gif[0] image0.gif 

gets the first frame

or

Code: Select all

convert image.gif image_%d.gif 
converts all frames as image_1.gif, image_2.gif, etc

If your frames are not transparent already, then you will need to process them while or after extracting them. I am not sure what parts you want transparent or if you want them to be completely transparent everywhere. You will need to clarify that further.

Re: Converting an animated gif into a 3 layered image

Posted: 2009-08-14T00:13:46-07:00
by Yverman
Hi there

I'm extracting the frames from the gif as mentioned but in my case, i have a real problem with the quality.

My original gif is:
http://www.livesystems.ch/media/animated.gif

This gif has 4 frames but only the first one is extracted okey. for example the second one looks like this:
http://www.livesystems.ch/media/out_1.gif

has anyone any idae why my convert does not function? i tried serveral things:

convert animated.gif out_%d.gif

convert animated.gif[1] test2.jpg

mogrify -sharpen 0x1 -format gif/jpg/png out.gif

thank you for your help

Re: Converting an animated gif into a 3 layered image

Posted: 2009-08-14T07:57:19-07:00
by fmw42
animated gifs are often stored as partial updates in each frame. So the get the full frame of each you need to use -coalesce to extract them

convert animate.gif -coalesce animate_%d.gif

Then you can process each frame individually.

see http://www.imagemagick.org/Usage/anim_basics/#coalesce

Re: Converting an animated gif into a 3 layered image

Posted: 2009-08-17T00:13:20-07:00
by anthony
Looks more like JPEG compression artifacts to me!!!!!

Re: Converting an animated gif into a 3 layered image

Posted: 2009-08-17T05:24:23-07:00
by Yverman
the thing with coalesce worked perfectly for me. thank you for your help!

Re: Converting an animated gif into a 3 layered image

Posted: 2009-08-17T17:45:18-07:00
by anthony
fmw42 wrote:animated gifs are often stored as partial updates in each frame. So the get the full frame of each you need to use -coalesce to extract them

convert animate.gif -coalesce animate_%d.gif

Then you can process each frame individually.

see http://www.imagemagick.org/Usage/anim_basics/#coalesce
Note however that the first frame is usally either a complete frame (there was not data present before that) OR a 'zero delay' frame that just sets a background for the rest of the the animation. It is the second and later frames that will need the 'coalesce' to de-optimize the animation (for pixel count and data compression).

See Cleared Frame Animations -- adding a background.
http://www.imagemagick.org/Usage/anim_basics/#cleared

Of course as most web browsers don't handle a 'zero delay frame' correctly (just doing the action but skipping its display of zero time) such frames are not common.