Python使用PIL调整动画gif的大小 [英] Python resizing animated gif with PIL

查看:327
本文介绍了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)

这篇关于Python使用PIL调整动画gif的大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆