Skip to content

Commit

Permalink
Document format limitations of ImageStat.Stat.extrema and recommend m…
Browse files Browse the repository at this point in the history
…ore efficient Image.getextrema
  • Loading branch information
hugovk committed Mar 6, 2019
1 parent 8194677 commit 6f24eda
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions docs/reference/ImageStat.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@ for a region of an image.
Min/max values for each band in the image.

.. Note:: This relies on the :py:meth:`~PIL.Image.histogram` method, and simply
returns the low and high bins used. This is correct for images with 8 bits per
channel, but fails for other modes such as ``I`` or ``F``. Instead, use
:py:meth:`~PIL.Image.getextrema` to return per-band extrema for the image.
This is more correct and efficient because :py:meth:`~PIL.Image.getextrema` is
used by the histogram method for non-8-bit modes to return extrema to define the
bins used in the histogram.

.. py:attribute:: count
Total number of pixels for each band in the image.
Expand Down

0 comments on commit 6f24eda

Please sign in to comment.