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?

2 Answers 2

61

I've found -dispose previous.

UPDATE

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

1
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
1
  • 10
    Using -dispose previous almost worked, with the first image never going away. I found that using -dispose 2 worked. Aug 19, 2016 at 19:08

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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