ImageSequence Module

doc

https://pillow.readthedocs.io/en/latest/reference/ImageSequence.html, http://effbot.org/imagingbook/imagesequence.htm

ImageChops_blend_02.gif: see blend.

>>> from PIL import Image, ImageSequence
>>> img = Image.open("result/ImageChops_blend_02.gif")
>>> for i, frame in enumerate(ImageSequence.Iterator(img)):
...     # avoid "IOError: cannot write mode P as JPEG"
...     dst = frame.convert("RGB")
...     dst.save("frame_%d.jpg" % i)
...
>>> #

Note

Pillow version < 3.4 can’t write image sequence as animation GIF, but can recognize it as sequence.

See also seek, tell.