Python使用PIL调整动画gif的大小

Python使用PIL调整动画gif的大小

问题描述:

我按照调整GIF动画大小,pil / imagemagick, python 使用 PIL image2gif 调整图像大小。但是,我得到了如下调整大小的gif:

I follow the step at Resize GIF animation, pil/imagemagick, python to resize image using PIL and image2gif. However, I got the resized gif washed out like below:

如何解决此问题?

我没试过这个,但是这个建议保存时使用PIL保持GIF图像透明度的方法是:

I have not tried this, but this suggests that the way to maintain transparency in GIF images with PIL when saving is:

im = Image.open(...)
transparency = im.info["transparency"]
...
out.save("out.gif", transparency=transparency)