为了账号安全,请及时绑定邮箱和手机立即绑定

Python PIL创建gif失败

Python PIL创建gif失败

蛊毒传说 2021-08-17 09:54:45
我试图使用 PIL 创建一个 gif,如下所述:http : //www.pythoninformer.com/python-libraries/pillow/creating-animated-gif/以及他们显示的将一堆图像“名称”保存到 gif 中的代码:# Open all the framesimages = []for n in names:    frame = Image.open(n)    images.append(frame)# Save the frames as an animated GIFimages[0].save('anicircle.gif',               save_all=True,               append_images=images[1:],               duration=100,               loop=0)但是,保存 gif 时它只保存一张图像,我做错了什么?我在 python 2.7 中使用 PIL 版本 1.1.7
查看完整描述

1 回答

?
慕慕森

TA贡献1856条经验 获得超17个赞

我不认为你的代码有什么问题。我会检查您使用的枕头版本。


from PIL import Image

Image.PILLOW_VERSION

append_images 是在 Pillow 3.4.0 中添加的,因此您至少需要使用该版本。


查看完整回答
反对 回复 2021-08-17
  • 1 回答
  • 0 关注
  • 198 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信