36

I have an animation as a batch of .png files (100 files). The background is transparent in the source .png files. I want to convert them into a single animated gif. I have tried this command:

convert -delay 0 -loop 0 -alpha set *.png ani.gif

But the result is the following (green is the HTML page background):

enter image description here

How should I remove the previous frames from an every following one?

noober
  • 4,819
  • 12
  • 49
  • 85

2 Answers2

61

I've found -dispose previous.

UPDATE

OK, convert -delay 0 -loop 0 -alpha set -dispose previous *.png ani.gif

noober
  • 4,819
  • 12
  • 49
  • 85
  • 1
    If you still face transparency issue you should set `-dispose background` . More info: https://superuser.com/questions/555490/transparency-issues-when-converting-pngs-to-gif – Olivier D'Ancona Mar 06 '22 at 14:15
21

The solution is here:

http://www.alecjacobson.com/weblog/?p=2601

The magic keyword seems to be “dispose” and calling the following fixed the problem:

convert -dispose 2 screencapture-*.tga screencapture.gif