Fully document PIL.ImageSequence

This commit is contained in:
Stephen Johnson 2013-10-13 21:49:35 -07:00
parent 1a72ba260a
commit f284c194ca
4 changed files with 37 additions and 14 deletions

View File

@ -14,15 +14,18 @@
# #
## ##
# This class implements an iterator object that can be used to loop
# over an image sequence.
class Iterator: class Iterator:
"""
This class implements an iterator object that can be used to loop
over an image sequence.
## You can use the ``[]`` operator to access elements by index. This operator
# Create an iterator. will raise an :py:exc:`IndexError` if you try to access a nonexistent
# frame.
# @param im An image object.
:param im: An image object.
"""
def __init__(self, im): def __init__(self, im):
if not hasattr(im, "seek"): if not hasattr(im, "seek"):

View File

@ -86,14 +86,6 @@ can be found here.
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
:mod:`ImageSequence` Module
---------------------------
.. automodule:: PIL.ImageSequence
:members:
:undoc-members:
:show-inheritance:
:mod:`ImageShow` Module :mod:`ImageShow` Module
----------------------- -----------------------

View File

@ -0,0 +1,27 @@
.. py:module:: PIL.ImageSequence
.. py:currentmodule:: PIL.ImageSequence
:py:mod:`ImageSequence` Module
==============================
The :py:mod:`ImageSequence` module contains a wrapper class that lets you
iterate over the frames of an image sequence.
Extracting frames from an animation
-----------------------------------
.. code-block:: python
from PIL import Image, ImageSequence
im = Image.open("animation.fli")
index = 1
for frame in ImageSequence.Iterator(im):
frame.save("frame%d.png" % index)
index = index + 1
The :py:class:`~PIL.ImageSequence.Iterator` class
-------------------------------------------------
.. autoclass:: PIL.ImageSequence.Iterator

View File

@ -18,4 +18,5 @@ Reference
ImagePalette ImagePalette
ImagePath ImagePath
ImageQt ImageQt
ImageSequence
../PIL ../PIL