ImageMagick and transparent background for animate

2020-05-30 01:40发布

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?

标签: imagemagick
2条回答
贼婆χ
2楼-- · 2020-05-30 02:14

I've found -dispose previous.

UPDATE

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

查看更多
一夜七次
3楼-- · 2020-05-30 02:23

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
查看更多
登录 后发表回答