mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-03-23 19:44:13 +03:00
Merge pull request #4739 from nulano/refs-animated
This commit is contained in:
commit
97830a5e99
|
@ -330,6 +330,36 @@ Instances of the :py:class:`Image` class have the following attributes:
|
||||||
|
|
||||||
Unless noted elsewhere, this dictionary does not affect saving files.
|
Unless noted elsewhere, this dictionary does not affect saving files.
|
||||||
|
|
||||||
|
.. py:attribute:: Image.is_animated
|
||||||
|
:type: bool
|
||||||
|
|
||||||
|
``True`` if this image has more than one frame, or ``False`` otherwise.
|
||||||
|
|
||||||
|
This attribute is only defined by image plugins that support animated images.
|
||||||
|
Plugins may leave this attribute undefined if they don't support loading
|
||||||
|
animated images, even if the given format supports animated images.
|
||||||
|
|
||||||
|
Given that this attribute is not present for all images use
|
||||||
|
``getattr(image, "is_animated", False)`` to check if Pillow is aware of multiple
|
||||||
|
frames in an image regardless of its format.
|
||||||
|
|
||||||
|
.. seealso:: :attr:`~Image.n_frames`, :func:`~Image.seek` and :func:`~Image.tell`
|
||||||
|
|
||||||
|
.. py:attribute:: Image.n_frames
|
||||||
|
:type: int
|
||||||
|
|
||||||
|
The number of frames in this image.
|
||||||
|
|
||||||
|
This attribute is only defined by image plugins that support animated images.
|
||||||
|
Plugins may leave this attribute undefined if they don't support loading
|
||||||
|
animated images, even if the given format supports animated images.
|
||||||
|
|
||||||
|
Given that this attribute is not present for all images use
|
||||||
|
``getattr(image, "n_frames", 1)`` to check the number of frames that Pillow is
|
||||||
|
aware of in an image regardless of its format.
|
||||||
|
|
||||||
|
.. seealso:: :attr:`~Image.is_animated`, :func:`~Image.seek` and :func:`~Image.tell`
|
||||||
|
|
||||||
Classes
|
Classes
|
||||||
-------
|
-------
|
||||||
|
|
||||||
|
|
|
@ -2177,6 +2177,9 @@ class Image:
|
||||||
|
|
||||||
See :py:meth:`~PIL.Image.Image.tell`.
|
See :py:meth:`~PIL.Image.Image.tell`.
|
||||||
|
|
||||||
|
If defined, :attr:`~PIL.Image.Image.n_frames` refers to the
|
||||||
|
number of available frames.
|
||||||
|
|
||||||
:param frame: Frame number, starting at 0.
|
:param frame: Frame number, starting at 0.
|
||||||
:exception EOFError: If the call attempts to seek beyond the end
|
:exception EOFError: If the call attempts to seek beyond the end
|
||||||
of the sequence.
|
of the sequence.
|
||||||
|
@ -2261,6 +2264,9 @@ class Image:
|
||||||
"""
|
"""
|
||||||
Returns the current frame number. See :py:meth:`~PIL.Image.Image.seek`.
|
Returns the current frame number. See :py:meth:`~PIL.Image.Image.seek`.
|
||||||
|
|
||||||
|
If defined, :attr:`~PIL.Image.Image.n_frames` refers to the
|
||||||
|
number of available frames.
|
||||||
|
|
||||||
:returns: Frame number, starting with 0.
|
:returns: Frame number, starting with 0.
|
||||||
"""
|
"""
|
||||||
return 0
|
return 0
|
||||||
|
|
Loading…
Reference in New Issue
Block a user