猿问

Python PIL创建gif失败

我试图使用 PIL 创建一个 gif,如下所述:http : //www.pythoninformer.com/python-libraries/pillow/creating-animated-gif/


以及他们显示的将一堆图像“名称”保存到 gif 中的代码:


# Open all the frames

images = []


for n in names:

    frame = Image.open(n)

    images.append(frame)


# Save the frames as an animated GIF

images[0].save('anicircle.gif',

               save_all=True,

               append_images=images[1:],

               duration=100,

               loop=0)

但是,保存 gif 时它只保存一张图像,我做错了什么?我在 python 2.7 中使用 PIL 版本 1.1.7


蛊毒传说
浏览 199回答 1
1回答

慕慕森

我不认为你的代码有什么问题。我会检查您使用的枕头版本。from PIL import ImageImage.PILLOW_VERSIONappend_images 是在 Pillow 3.4.0 中添加的,因此您至少需要使用该版本。
随时随地看视频慕课网APP

相关分类

Python
我要回答