| Server IP : 202.61.199.114 / Your IP : 216.73.217.139 Web Server : nginx/1.22.1 System : Linux de.arni-solutions.de 6.1.0-49-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.174-1 (2026-05-26) x86_64 User : web20 ( 1018) PHP Version : 8.4.23 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /tmp/calpy/PIL/__pycache__/ |
Upload File : |
�
Υ=jw � �P � d dl mZ d dlZd dlmZ ddlmZ G d� d� � ZeZdS )� )�annotationsN)�cached_property� )�Imagec �� � e Zd Z ddd�Zedd
�� � Zedd�� � Zedd�� � Zedd�� � Zedd�� � Z edd�� � Z
edd�� � Zedd�� � Zedd�� � Z
dS )�StatN�
image_or_list�Image.Image | list[int]�mask�Image.Image | None�return�Nonec �8 � t |t j � � r|� |� � | _ n.t |t � � r|| _ nd}t |� � �t t
t | j � � dz � � � � | _ dS )a
Calculate statistics for the given image. If a mask is included,
only the regions covered by that mask are included in the
statistics. You can also pass in a previously calculated histogram.
:param image: A PIL image, or a precalculated histogram.
.. note::
For a PIL image, calculations rely on the
:py:meth:`~PIL.Image.Image.histogram` method. The pixel counts are
grouped into 256 bins, even if the image has more than 8 bits per
channel. So ``I`` and ``F`` mode images have a maximum ``mean``,
``median`` and ``rms`` of 255, and cannot have an ``extrema`` maximum
of more than 255.
:param mask: An optional mask.
z$first argument must be image or list� N) �
isinstancer � histogram�h�list� TypeError�range�len�bands)�selfr r �msgs �@/tmp/claude-1015/pip-target-jmvfl800/lib/python/PIL/ImageStat.py�__init__z
Stat.__init__ s� � �* �m�U�[�1�1� !�"�,�,�T�2�2�D�F�F�
�
�t�
,�
,� !�"�D�F�F�8�C��C�.�.� ��%��D�F���s� 2�3�3�4�4��
�
�
� �list[tuple[int, int]]c �n � �� d d���� fd�t dt � j � � d� � D � � S )
au
Min/max values for each band in the image.
.. note::
This relies on the :py:meth:`~PIL.Image.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.Image.getextrema` to
return per-band extrema for the image. This is more correct and
efficient because, for non-8-bit modes, the histogram method uses
:py:meth:`~PIL.Image.Image.getextrema` to determine the bins used.
r � list[int]r
�tuple[int, int]c � � d\ }}t d� � D ]}| | r|} n�t ddd� � D ]}| | r|} n�||fS )N)� r r r# ���)r )r �res_min�res_max�is r �minmaxzStat.extrema.<locals>.minmaxM s� � �%��G�W��3�Z�Z�
�
���Q�<� ��G��E�� �3��B�'�'�
�
���Q�<� ��G��E�� �G�#�#r c �@ �� g | ]} ��j |d � � � ��S �N)r )�.0r'