2013-10-14 08:49:35 +04:00
|
|
|
.. py:module:: PIL.ImageSequence
|
|
|
|
.. py:currentmodule:: PIL.ImageSequence
|
|
|
|
|
2020-06-22 06:52:50 +03:00
|
|
|
:py:mod:`~PIL.ImageSequence` Module
|
|
|
|
===================================
|
2013-10-14 08:49:35 +04:00
|
|
|
|
2020-06-22 06:52:50 +03:00
|
|
|
The :py:mod:`~PIL.ImageSequence` module contains a wrapper class that lets you
|
2013-10-14 08:49:35 +04:00
|
|
|
iterate over the frames of an image sequence.
|
|
|
|
|
|
|
|
Extracting frames from an animation
|
|
|
|
-----------------------------------
|
|
|
|
|
|
|
|
.. code-block:: python
|
|
|
|
|
|
|
|
from PIL import Image, ImageSequence
|
|
|
|
|
2020-02-29 02:29:44 +03:00
|
|
|
with Image.open("animation.fli") as im:
|
|
|
|
index = 1
|
|
|
|
for frame in ImageSequence.Iterator(im):
|
2020-07-16 12:43:29 +03:00
|
|
|
frame.save(f"frame{index}.png")
|
2020-02-29 02:29:44 +03:00
|
|
|
index += 1
|
2013-10-14 08:49:35 +04:00
|
|
|
|
|
|
|
The :py:class:`~PIL.ImageSequence.Iterator` class
|
|
|
|
-------------------------------------------------
|
|
|
|
|
|
|
|
.. autoclass:: PIL.ImageSequence.Iterator
|
2019-04-21 16:28:08 +03:00
|
|
|
:members:
|