Image magick / GD transparency clipping of animated gif frames
Let's consider the following scenario:
You want to split a gif in individual frames, that can be done nicely with image magick with the following codeconvert canvas_prev.gif -scene 1 +adjoin frame_%03d.gif
Then you want to copy another image over each resulting framecomposite -gravity center frame_001.gif new.gif composed_frame.gif
And here's the catch. When you copy the frame over the new image image magick the transparency around the image frame gets clipped and the positioning will be different.
A way that I've found to get around this issue is to use -coalesce option.
What the heck does that do you ask?
Well the documentation from image magick says:
Fully define the look of each frame of an GIF animation sequence, to form a 'film strip' animation.
But an image is better than a thousand words so you can look here
As you can see the main difference is that if you have an image of 3 frames they're not going to be split as 1.gif, 2.gif, 3.gif but as 1.gif, 1+2.gif, 1+2+3.gif
Comments
Code Monkey (not verified)
Thu, 01/15/2009 - 19:15
Permalink
Informative and interesting
Informative and interesting post. Thanks.
Pages
Add new comment