3

I want to convert an image sequence into a gif animation, and i'm using this:

convert -delay 100 -loop 0 image*.jpg animation.gif

The problem is that for transparent images i can see other images under the animation. Why?

For example, with these two images:

enter image description here enter image description here

In the generated gif animation, the first image shown is the "A" one, and the second, instead of the "B" one, is

enter image description here

I really don't know what's going on here, what am I missing?

  • You may wish to edit your question in order to set the proper image type in the command line as: convert -delay 100 -loop 0 image*.png animation.gif because of the provided images are transparency png's whose result will be in a transparent animation. JPG's won't have a transparent background thus the animation optical illusion will work. – Geppettvs D'Constanzo Oct 24 '13 at 15:43
6

If you use the -dispose Background option, when a frame is added to the canvas, it will clear the background before the next image is overlaid. For example:

convert -delay 100 -dispose Background *.png anim.gif

Additional info can be found in the Animation Basics page of the ImageMagick docs.

4

GIFs do not have transparent layers. The images must all have the same background color, like, say, cyan, and that color is specified as being the color that gets converted to transparent, in the image. You pass that color to convert with the -transparent-color option.

  • Thanks. Can you make an example? – BackSlash Oct 24 '13 at 14:48
  • 1
  • @BackSlash: general examples will not work here. It really depends on your source, what your transparency setting are, pictures size, number of frames, and what not... if you had gone through the tutorial I linked to below you might get an idea why generating transparent GIF animations are not really a trivial task where a single example command will work out for you. – Takkat Oct 24 '13 at 17:47
  • @Takkat That is not true. Making a "transparent animated gif" is just as easy now, as it was 15 years ago when it was still relevant to do it. All you need is to make proper transparent gifs, and pass the right arguments to convert. The dithering and extra stuff is just to make the animation smoother and look better in some cases. – dobey Oct 24 '13 at 17:52

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.