Document alternatives to accessing individual pixels

This commit is contained in:
Andrew Murray 2022-03-01 14:13:40 +11:00
parent 37d28ce514
commit 4615e1d42a
2 changed files with 14 additions and 4 deletions

View File

@ -6,7 +6,13 @@
The PixelAccess class provides read and write access to The PixelAccess class provides read and write access to
:py:class:`PIL.Image` data at a pixel level. :py:class:`PIL.Image` data at a pixel level.
.. note:: Accessing individual pixels is fairly slow. If you are looping over all of the pixels in an image, there is likely a faster way using other parts of the Pillow API. .. note:: Accessing individual pixels is fairly slow. If you are
looping over all of the pixels in an image, there is likely
a faster way using other parts of the Pillow API.
:mod:`~PIL.Image`, :mod:`~PIL.ImageChops` and :mod:`~PIL.ImageOps`
have methods for many standard operations. If you wish to perform
a custom mapping, check out :py:meth:`~PIL.Image.Image.point`.
Example Example
------- -------
@ -39,7 +45,7 @@ Access using negative indexes is also possible.
:py:class:`PixelAccess` Class :py:class:`PixelAccess` Class
----------------------------------- -----------------------------
.. class:: PixelAccess .. class:: PixelAccess

View File

@ -7,8 +7,12 @@
The :py:mod:`~PIL.PyAccess` module provides a CFFI/Python implementation of the :ref:`PixelAccess`. This implementation is far faster on PyPy than the PixelAccess version. The :py:mod:`~PIL.PyAccess` module provides a CFFI/Python implementation of the :ref:`PixelAccess`. This implementation is far faster on PyPy than the PixelAccess version.
.. note:: Accessing individual pixels is fairly slow. If you are .. note:: Accessing individual pixels is fairly slow. If you are
looping over all of the pixels in an image, there is likely looping over all of the pixels in an image, there is likely
a faster way using other parts of the Pillow API. a faster way using other parts of the Pillow API.
:mod:`~PIL.Image`, :mod:`~PIL.ImageChops` and :mod:`~PIL.ImageOps`
have methods for many standard operations. If you wish to perform
a custom mapping, check out :py:meth:`~PIL.Image.Image.point`.
Example Example
------- -------