Saving an animated GIF in Pillow
python, python-imaging-library
Solution
Use the script found on the Pillow Github, here.
from PIL import ImageSequence
from PIL import Image
import gifmaker
sequence = []
im = Image.open(....)
# im is your original image
frames = [frame.copy() for frame in ImageSequence.Iterator(im)]
# write GIF animation
fp = open("out.gif", "wb")
gifmaker.makedelta(fp, frames)
fp.close()
Problem
(Python 3.4, PIL 1.1.7, Pillow 2.5.1) I expected this to copy the original GIF. ``` from PIL import Image im = Image.open(filename) im.save('temp.gif') ``` Instead, it saves the first frame as a still. What am I doing wrong?