__  __    __   __  _____      _            _          _____ _          _ _ 
 |  \/  |   \ \ / / |  __ \    (_)          | |        / ____| |        | | |
 | \  / |_ __\ V /  | |__) | __ ___   ____ _| |_ ___  | (___ | |__   ___| | |
 | |\/| | '__|> <   |  ___/ '__| \ \ / / _` | __/ _ \  \___ \| '_ \ / _ \ | |
 | |  | | |_ / . \  | |   | |  | |\ V / (_| | ||  __/  ____) | | | |  __/ | |
 |_|  |_|_(_)_/ \_\ |_|   |_|  |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1
 if you need WebShell for Seo everyday contact me on Telegram
 Telegram Address : @jackleet
        
        
For_More_Tools: Telegram: @jackleet | Bulk Smtp support mail sender | Business Mail Collector | Mail Bouncer All Mail | Bulk Office Mail Validator | Html Letter private



Upload:

Command:

[email protected]: ~ $
�

"%vg�:�
�`
�%SSKJr SSKrSSKrSSKrSSKrSSKrSSKrSSKrSSK	r	SSK
r
SSKrSSKrSSK
r
SSKJrJrJrJr SSKJr SSKJr SSKJrJrJrJrJrJr SSKJrJ r J!r!J"r"J#r#J$r$ SS	K%J&r&J'r'J(r( SS
K)J*r* SSK+J,r,J-r- S\.S
'SSK/J0r0 \Rd"\35r4"SS\55r6"SS\75r8Sr9S\.S'\:"S5r;S\.S'SSKJ<r= \#\>"\=SS5:waS\>"\=SS5S\#3r?\1"\?5eS�S!jrE"S"S#\5rF"S$S%\5rG"S&S'\5rH\HR�S(\HR�S)\HR�S)\HR�S*\HR�S+0rN"S,S-\5rO"S.S/\5rP"S0S1\5rQ\R�\3rS\F\G\H\O\P\Q4H*r\H!rT\U"\S\TR�\TR�5 M# M, \X"\=S25(a<\=R�rY\=R�rZ\=R�r[\=R�r\\=R�r]\(a*SSK^r^SS3K_J`r` SS4KaJbrb SS5KJcrcJdrdJereJfrfJgrg SS6KhJiriJjrjJkrkJlrl /rmS7\.S8'0rnS9\.S:'0roS;\.S<'0rpS=\.S>'0rqS=\.S?'0rrS;\.S@'0rsSA\.SB'0rtSC\.SD'\R�SE:XaSFOSGrvS�SIjrw/SJQrxSKryS�SLjrzS�SMjr{S�SNjr|S�SOjr}Sq~S�SPjrS�SQjr�S�S�SRjjr�S�S�SSjjr�"STSU5r�S�SVjr�"SWSX\5r�"SYSH5r�"SZS[5r�"S\S]5r�S�S^jr�S�S_jr�S�S�S`jjrAS�S�Sajjr�S�S�Sbjjr�"ScSd\5r�S�S�Sejjr�S�Sfjr�S�Sgjr�0ShSi_SjSk_SlSm_SnSo_SpSq_SrSs_StSu_SvSw_SxSy_SzS{_S|S}_S~S_S�S�_S�S�_S�S�_S�S�_S�S�_S�S�S�\vS�34S�S�\vS�34S�0Er�S�S�jr�S�S�S�jjr�S�S�jr�S�S�jr�S�S�jr�S�S�jr�S�S�jr�S�S�S�jjr�S�S�jr�S�S�jr�S�S�jr�S�S�jr�S�S�jr�S�S�jr�S�S�jr�S�S�jr�S�S�jr�S�S�jr�S�S�jr�S�S�jr�S�S�jr�S�S�S�jjr�\�"5 \GRP"\=GRR5 \(a\\:\4r�O\r�"S�S�\�5r�g!\1a Sr0GNf=f!\1a�r@\,R�"\1"S55r=\B"\@5R�S5(a\
R�"S\55 e\B"\@5R�S 5(a\
R�"\B"\@5\55 eSr@C@ff=f)��)�annotationsN)�Callable�Iterator�MutableMapping�Sequence)�IntEnum)�
ModuleType)�IO�
TYPE_CHECKING�Any�Literal�Protocol�cast�)�ExifTags�	ImageMode�TiffTags�UnidentifiedImageError�__version__�_plugins)�i32le�o32be�o32le)�	deprecate)�
DeferredError�is_pathzModuleType | None�ElementTree)rc��\rSrSrSrg)�DecompressionBombWarning�M�N��__name__�
__module__�__qualname__�__firstlineno__�__static_attributes__r!��+/usr/lib/python3/dist-packages/PIL/Image.pyrrM���r(rc��\rSrSrSrg)�DecompressionBombError�Qr!Nr"r!r(r)r,r,Qr*r(r,F�bool�WARN_POSSIBLE_FORMATSiUUU�
int | None�MAX_IMAGE_PIXELS)�_imaging�PILLOW_VERSIONzUThe _imaging extension was built for another version of Pillow or PIL:
Core version: z
Pillow version: z'The _imaging C module is not installed.zModule use of pythonz?The _imaging extension was built for another version of Python.zThe _imaging extensionc�4�[SSS5 [US5$)z�
Checks if an object is an image object.

.. warning::

   This function is for internal use only.

:param t: object to check if it's an image
:returns: True if the object is an image
zImage.isImageType(im)�zisinstance(im, Image.Image)�im)r�hasattr)�ts r)�isImageTyper9}s���%�r�+H�I��1�d��r(c�0�\rSrSrSrSrSrSrSrSr	Sr
S	rg
)�	Transpose�rr�����r!N)r#r$r%r&�FLIP_LEFT_RIGHT�FLIP_TOP_BOTTOM�	ROTATE_90�
ROTATE_180�
ROTATE_270�	TRANSPOSE�
TRANSVERSEr'r!r(r)r;r;�s%���O��O��I��J��J��I��Jr(r;c�(�\rSrSrSrSrSrSrSrSr	g)	�	Transform�rrr=r>r?r!N)
r#r$r%r&�AFFINE�EXTENT�PERSPECTIVE�QUAD�MESHr'r!r(r)rJrJ�s��
�F�
�F��K��D��Dr(rJc�,�\rSrSrSrSrSrSrSrSr	Sr
g	)
�
Resampling�rr?r=r@r>rr!N)r#r$r%r&�NEAREST�BOX�BILINEAR�HAMMING�BICUBIC�LANCZOSr'r!r(r)rRrR�s ���G�
�C��H��G��G��Gr(rR��?��?�@g@c�$�\rSrSrSrSrSrSrSrg)�Dither�rrr=r>r!N)	r#r$r%r&�NONE�ORDERED�	RASTERIZE�FLOYDSTEINBERGr'r!r(r)r^r^�s���D��G��I��Nr(r^c��\rSrSrSrSrSrg)�Palette�rrr!N)r#r$r%r&�WEB�ADAPTIVEr'r!r(r)rere�s��
�C��Hr(rec�$�\rSrSrSrSrSrSrSrg)�Quantize��rrr=r>r!N)	r#r$r%r&�	MEDIANCUT�MAXCOVERAGE�
FASTOCTREE�
LIBIMAGEQUANTr'r!r(r)rjrj�s���I��K��J��Mr(rj�DEFAULT_STRATEGY)�Element)�
PrettyPrinter)�	ImageFile�ImageFilter�ImagePalette�ImageQt�TiffImagePlugin)�CapsuleType�
NumpyArray�StrOrBytesPath�	TypeGuard�	list[str]�IDzodict[str, tuple[Callable[[IO[bytes], str | bytes], ImageFile.ImageFile], Callable[[bytes], bool | str] | None]]�OPEN�dict[str, str]�MIMEz:dict[str, Callable[[Image, IO[bytes], str | bytes], None]]�SAVE�SAVE_ALL�	EXTENSIONz$dict[str, type[ImageFile.PyDecoder]]�DECODERSz$dict[str, type[ImageFile.PyEncoder]]�ENCODERS�little�<�>�Imagec���[R"UR5nURUR4n[UR5nUS:waX#4-
nX!R4$�Nr)r�getmode�mode�height�width�len�bands�typestr)r6�m�shape�extras    r)�_conv_type_shaper��sS�����"�'�'�"�A� �i�i����2�E�����L�E���z�
�����)�)��r()�1�CMYK�F�HSV�I�I;16�I;16B�I;16LzI;16N�L�LA�La�LAB�P�PA�RGB�RGBA�RGBa�RGBX�YCbCr)r�r�r�r�r�r�r�r�c�B�[R"U5R$)a	
Gets the "base" mode for given mode.  This function returns "L" for
images that contain grayscale data, and "RGB" for images that
contain color data.

:param mode: Input mode.
:returns: "L" or "RGB".
:exception KeyError: If the input mode was not a standard mode.
)rr��basemode�r�s r)�getmodebaser�s�����T�"�+�+�+r(c�B�[R"U5R$)z�
Gets the storage type mode.  Given a mode, this function returns a
single-layer mode suitable for storing individual bands.

:param mode: Input mode.
:returns: "L", "I", or "F".
:exception KeyError: If the input mode was not a standard mode.
)rr��basetyper�s r)�getmodetyper�,s�����T�"�+�+�+r(c�B�[R"U5R$)a�
Gets a list of individual band names.  Given a mode, this function returns
a tuple containing the names of individual bands (use
:py:method:`~PIL.Image.getmodetype` to get the mode used to store each
individual band.

:param mode: Input mode.
:returns: A tuple containing band names.  The length of the tuple
    gives the number of bands in an image of the given mode.
:exception KeyError: If the input mode was not a standard mode.
)rr�r�r�s r)�getmodebandnamesr�8s�����T�"�(�(�(r(c�T�[[R"U5R5$)z�
Gets the number of individual bands for this mode.

:param mode: Input mode.
:returns: The number of bands in this mode.
:exception KeyError: If the input mode was not a standard mode.
)r�rr�r�r�s r)�getmodebandsr�Gs ���y� � ��&�,�,�-�-r(c�l�[S:�agSSKJn U(deSSKJn U(deSSKJn U(deSSKJn U(deSSKJn U(deSqg![a NSf=f![a NRf=f![a NQf=f![a NPf=f![a Sqgf=f)zp
Explicitly loads BMP, GIF, JPEG, PPM and PPM file format drivers.

It is called when opening or saving images.
rN)�BmpImagePlugin)�GifImagePlugin)�JpegImagePlugin)�PpmImagePlugin)�PngImagePlugin)�_initialized�r��ImportErrorr�r�r�r�)r�r�r�r�r�s     r)�preinitr�Xs����q���
�$���~�
�$���~�
�%����
�$���~�
�$���~��L��7�
��
���
��
���
��
���
��
���
���L�
�sW�A$�A4�B�B�B$�$
A1�0A1�4
B�B�
B�B�
B!� B!�$
B3�2B3c�f�[S:�ag[RS5Sn[H=n[RSU5 [
USU3[5[5/5 M? [(d[(aSqgg![a!n[RSX5 SnAM�SnAff=f)	z�
Explicitly initializes the Python Imaging Library. This function
loads all available file format drivers.

It is called when opening or saving images if :py:meth:`~preinit()` is
insufficient, and by :py:meth:`~PIL.features.pilinfo`.
r=F�.rzImporting %szImage: failed to import %s: %sNT)r�r#�
rpartitionr�logger�debug�
__import__�globals�localsr�r~r�)�parent_name�plugin�es   r)�initr��s����q����%�%�c�*�1�-�K���	F��L�L���0��+��a��x�0�'�)�V�X�r�J���t�t�t������
�	F��L�L�9�6�E�E��	F�s�9B�
B0�B+�+B0c��UcSnO[U[5(dU4n[UnU"U/X#-Q76$![a Of=f[	[
US35nO$![anSUS3n[U5UeSnAff=fU"U/X#-Q76$)Nr!�_decoderzdecoder � not available)�
isinstance�tupler��KeyError�getattr�core�AttributeError�OSError)r��decoder_name�argsr��decoderr��msgs       r)�_getdecoderr������|���
��e�
$�
$��w��,��<�(���t�+�d�l�+�+���
��
��
"��$�<�.�� 9�:����"����n�5���c�l��!��"���4�'�$�,�'�'�'�	4�
A�A�A�
A:�#A5�5A:c��UcSnO[U[5(dU4n[UnU"U/X#-Q76$![a Of=f[	[
US35nO$![anSUS3n[U5UeSnAff=fU"U/X#-Q76$)Nr!�_encoderzencoder r�)r�r�r�r�r�r�r�r�)r��encoder_namer�r��encoderr�r�s       r)�_getencoderr��r�r�c�f�\rSrSrSrSSjrS
SjrSSjr\rSSjr	SSjr
SSjr\rSS	jr
S
rg)�ImagePointTransformi�z�
Used with :py:meth:`~PIL.Image.Image.point` for single band images with more than
8 bits, this represents an affine transformation, where the value is multiplied by
``scale`` and ``offset`` is added.
c��XlX lg�N)�scale�offset)�selfr�r�s   r)�__init__�ImagePointTransform.__init__�s���
��r(c�F�[UR*UR*5$r�)r�r�r��r�s r)�__neg__�ImagePointTransform.__neg__�s��"�D�J�J�;�����=�=r(c���[U[5(a:[URUR-URUR-5$[URURU-5$r�)r�r�r�r��r��others  r)�__add__�ImagePointTransform.__add__�sX���e�0�1�1�&��
�
�U�[�[�(�$�+�+����*D��
�#�4�:�:�t�{�{�U�/B�C�Cr(c��X*-$r�r!r�s  r)�__sub__�ImagePointTransform.__sub__�s���f�}�r(c��X*-$r�r!r�s  r)�__rsub__�ImagePointTransform.__rsub__�s���u�}�r(c��[U[5(a[$[URU-URU-5$r��r�r��NotImplementedr�r�r�s  r)�__mul__�ImagePointTransform.__mul__��5���e�0�1�1�!�!�"�4�:�:��#5�t�{�{�U�7J�K�Kr(c��[U[5(a[$[URU-URU-5$r�r�r�s  r)�__truediv__�ImagePointTransform.__truediv__�r�r()r�r�N)r��floatr�r�return�None)rr�)r�zImagePointTransform | floatrr�)r#r$r%r&�__doc__r�r�r��__radd__r�r�r��__rmul__rr'r!r(r)r�r��s;����>�D��H���L�
�H�Lr(r�c��U"[SS55n[U[5(aURUR4$SU4$�Nrr)r�r�r�r�)�expr�as  r)�_getscaleoffsetrs?��	
�
 ��A�
&�'�A�",�Q�0C�"D�"D�A�G�G�Q�X�X��P�1�a�&�Pr(c�"�\rSrSrSSjrSrg)�SupportsGetDataic��gr�r!r�s r)�getdata�SupportsGetData.getdatas��*-r(r!N)rztuple[Transform, Sequence[int]])r#r$r%r&rr'r!r(r)rrs��.�	(�.r(rc�V�\rSrSr%SrSrS\S'SrS\S'SrS^Sjr	\
S_S	j5r\RS`S
j5r\
SaSj5r
\
SaSj5r\
SbS
j5r\
ScSj5rSdSjrSrSrSrS^SjrS^SjrS^SjrSeSfSjjrSgSjrScSjrShSjrSiSjrSjSjrSjSjr\
SkSj5rSlSjr SmSjr!SnSoS jjr"SpSqS!jjr#SnSrS"jjr$SsS#jr%S^S$jr&SSS\'RPS%4StS&jjr)S%SS'S\*RV4SuS(jjr,SvS)jr-\-r.SwSxS*jjr/SyS+jr0SzS,jr1SwS{S-jjr2S|S.jr3S}S/jr4SS0.S~S1jjr5SS�S2jjr6SwS�S3jjr7S�S4jr8S�S5jr9S�S6jr:S^S7jr;S�S8jr<S�S9jr=S�S�S:jjr>\
S�S;j5r?S^S<jr@S�S=jrAS�S>jrBSeS�S?jjrCSeS�S@jjrDSeS�SAjjrES�S�SBjjrFSwS�SCjjrGS�SDjrHS�S�SEjjrIS�S�SFjjrJS�SGjrKSwS�SHjjrLS�SIjrMS�S�SJjjrNSwS�SKjjrO\PR�SLSSS4S�SMjjrRSwS�SNjjrSS�SOjrTSwS�SPjjrUS�SQjrVS�SRjrWSaSSjrX\PR�ST4S�SUjjrZS\PR�SVS4S�SWjjr[\PR�S4S�SXjjr\S�SYjr]S�SZjr^S�S[jr_S�S\jr`S]rag)�r�ia$
This class represents an image object.  To create
:py:class:`~PIL.Image.Image` objects, use the appropriate factory
functions.  There's hardly ever any reason to call the Image constructor
directly.

* :py:func:`~PIL.Image.open`
* :py:func:`~PIL.Image.new`
* :py:func:`~PIL.Image.frombytes`
N�
str | None�format�format_descriptionTc�f�SUlSUlSUlSUl0UlSUlSUlg)Nr��rrr)�_im�_mode�_size�palette�info�readonly�_exifr�s r)r��Image.__init__%s6��=A�����
���
�9=���68��	���
�"&��
r(c��[UR[5(aURReURceUR$r�)r�rr�exr�s r)r6�Image.im0s:���d�h�h�
�.�.��(�(�+�+���x�x�#�#�#��x�x�r(c��Xlgr�)r�r�r6s  r)r6r"7s���r(c� �URS$�Nr��sizer�s r)r��Image.width;����y�y��|�r(c� �URS$r�r'r�s r)r��Image.height?r*r(c��UR$r�)rr�s r)r(�
Image.sizeC����z�z�r(c��UR$r�)rr�s r)r��
Image.modeGr/r(c�b�[5nXlURUlURUlURS;aMUR(a URR5UlOSSKJ	n UR"5UlURR5Ul
U$)N�r�r�r�ru)r�r6r�rr(rr�copyr�rur)r�r6�newrus    r)�_new�
Image._newKsu���g�����G�G��	��G�G��	�
�7�7�k�!��|�|�"�l�l�/�/�1���*�*�7�7�9����9�9�>�>�#����
r(c��U$r�r!r�s r)�	__enter__�Image.__enter__[s���r(c��[USS5(aMURUR:waURR5 [	[S55UlUR(aURR5 gg)N�_fpF�Operation on closed image)r�r=�fp�closer�
ValueErrorr�s r)�	_close_fp�Image._close_fp^sZ���4���&�&��x�x�4�7�7�"������ �$�Z�0K�%L�M�D�H��7�7��G�G�M�M�O�r(c�z�[US5(a*[USS5(aUR5 SUlgg)Nr?�
_exclusive_fpF)r7r�rBr?)r�r�s  r)�__exit__�Image.__exit__fs4���4�����t�_�e�4�4���� ��D�G�r(c��[US5(aUR5 SUl[
USS5(aSUl[[S55Ul
g![a n[RSU5 SnANXSnAff=f)ae
Closes the file pointer, if possible.

This operation will destroy the image core and release its memory.
The image data will be unusable afterward.

This function is required to close images that have multiple frames or
have not had their file read and closed by the
:py:meth:`~PIL.Image.Image.load` method. See :ref:`file-handling` for
more information.
r?NzError closing: %s�mapr>)r7rBr?�	Exceptionr�r�r�rIrrAr)r�r�s  r)r@�Image.closelsw���4����
7���� �����4���%�%�)-�D�H�
!��,G�!H�I�����
7����0�#�6�6��
7�s�A�
B�'B�Bc�p�UR5 URR5UlSUlgr&)�loadr6r5rr�s r)�_copy�Image._copy�s#���	�	���'�'�,�,�.�����
r(c�h�UR(aUR5 gUR5 gr�)rrNrMr�s r)�_ensure_mutable�Image._ensure_mutable�s���=�=��J�J�L��I�I�Kr(c�`�SnU(aSU3nU(d/[R"U5upV[R"U5 OUnUR	U5(dXd-nUR5 U(aUS:XaURRU5 U$UR"Xb40UD6 U$)Nr�r��PPM)	�tempfile�mkstemp�osr@�endswithrMr6�save_ppm�save)r��filer�options�suffix�f�filenames       r)�_dump�Image._dump�s���������\�F��"�*�*�6�2�K�A��H�H�Q�K��H��$�$�V�,�,�#�,���	�	����5���G�G���X�&���
�I�I�h�2�'�2��r(c��URURLag[U[5(deURUR:H=(a� URUR:H=(ai UR
UR
:H=(aI UR
5UR
5:H=(a! UR5UR5:H$�NF)�	__class__r�r�r�r(r�
getpalette�tobytesr�s  r)�__eq__�Image.__eq__�s����>�>����0���%��'�'�'�'��I�I����#�
2��	�	�U�Z�Z�'�
2��	�	�U�Z�Z�'�
2����!�U�%5�%5�%7�7�
2�����%�-�-�/�1�	
r(c���SURRSURRSURSURSSURSS[U5S	S
3
$)Nr�r�� image mode=� size=r�xrz at 0x�Xr�)rdr$r#r�r(�idr�s r)�__repr__�Image.__repr__�sm������)�)�*�!�D�N�N�,C�,C�+D�E��)�)��F�4�9�9�Q�<�.��$�)�)�A�,��H��t�H�Q�<�q�
"�	
r(c
���URSURRSURRSURSUR
SSUR
SS35 g	)
z"IPython plain text display supportr�r�rjrkrrlrr�N)�textrdr$r#r�r()r��p�cycles   r)�
_repr_pretty_�Image._repr_pretty_�sf��
	
�������)�)�*�!�D�N�N�,C�,C�+D�E��)�)��F�4�9�9�Q�<�.��$�)�)�A�,��q�
J�	
r(c��[R"5nUR"X140UD6 UR	5$![a gf=f)z�Helper function for iPython display hook.

:param image_format: Image format.
:returns: image as bytes, saved into the given format.
N)�io�BytesIOrZrJ�getvalue)r��image_format�kwargs�bs    r)�_repr_image�Image._repr_image�sG��
�J�J�L��	��I�I�a�0��0��z�z�|����	��	�s�:�
A�Ac�"�URSSS9$)zZiPython display hook support for PNG format.

:returns: PNG version of the image as bytes
�PNGr)�compress_level�r~r�s r)�
_repr_png_�Image._repr_png_�s��
����a��8�8r(c�$�URS5$)z\iPython display hook support for JPEG format.

:returns: JPEG version of the image as bytes
�JPEGr�r�s r)�_repr_jpeg_�Image._repr_jpeg_�s��
����'�'r(c��SS0nURS:XaURSS5US'OUR5US'[U5uUS'US'U$)	N�versionr>r��rawr��datar�r�)r�rfr�)r�r6s  r)�__array_interface__�Image.__array_interface__�s\��@I�!�n���9�9����,�,�u�c�2�C��K��,�,�.�C��K�'7��'=�$��G��c�)�n��
r(c��UR5nURURURUR	5U/$r�)rfrr�r(re)r��im_datas  r)�__getstate__�Image.__getstate__�s1���,�,�.���	�	�4�9�9�d�i�i����1B�G�L�Lr(c��[RU5 USSup#pEnX lX0lX@l[
R"X45UlUS;aU(aURU5 URU5 g)Nr@�r�r�r�r�)
r�r�rrrr�r6r6�
putpalette�	frombytes)r��staterr�r(rr�s       r)�__setstate__�Image.__setstate__�sb��
���t��*/���)�'��D�4��	��
��
��(�(�4�&����)�)�g��O�O�G�$����t�r(c�>�Un[U5S:Xa[US[5(aUSnUS:XaUS:XaURnUR	5 UR
S:XdURS:Xag[URX5nURUR5 [SURSS-5n/nURU5upxn	URU	5 U(aOM/US:aSUS	3n
[U
5eSRU5$)
a�
Return image as a bytes object.

.. warning::

    This method returns the raw image data from the internal
    storage.  For compressed image data (e.g. PNG, JPEG) use
    :meth:`~.save`, with a BytesIO parameter for in-memory
    data.

:param encoder_name: What encoder to use.  The default is to
                     use the standard "raw" encoder.

                     A list of C encoders can be seen under
                     codecs section of the function array in
                     :file:`_imaging.c`. Python encoders are
                     registered within the relevant plugins.
:param args: Extra arguments to the encoder.
:returns: A :py:class:`bytes` object.
rrr�r!r(ir?zencoder error z in tobytes)r�r�r�r�rMr�r�r��setimager6�maxr(�encode�append�RuntimeError�join)r�r�r��encoder_argsr��bufsize�output�bytes_consumed�errcoder�r�s           r)rf�
Image.tobytes�s��,!���|���!�j��a��%�&H�&H�'��?�L��5� �\�R�%7��9�9�L��	�	���:�:��?�d�k�k�Q�.��
��	�	�<�>��	�
�
�4�7�7���e�T�Y�Y�q�\�A�-�.�����,-�H�H�W�,=�)�N�T��M�M�$����	�
�Q�;�"�7�)�;�7�C��s�#�#��x�x���r(c�\�UR5 URS:wa
Sn[U5eURS5nSR	SUSUR
SS3R
S	5SUS
UR
SS3R
S	5SUS
3R
S	5US/5$)z�
Returns the image converted to an X11 bitmap.

.. note:: This method only works for mode "1" images.

:param name: The name prefix to use for the bitmap variables.
:returns: A string containing an X11 bitmap.
:raises ValueError: If the mode is not "1"
r�znot a bitmap�xbmr(z#define z_width r�
�asciiz_height rzstatic char z_bits[] = {
s};)rMr�rArfr�r(r�)r��namer�r�s    r)�tobitmap�Image.tobitmap3s���	
�	�	���9�9��� �C��S�/�!��|�|�E�"���x�x��4�&���	�	�!��~�R�8�?�?��H��4�&�����1���b�9�@�@��I��t�f�N�3�:�:�7�C���
�
�	
r(c��URS:XdURS:XagUn[U5S:Xa[US[5(aUSnUS:XaUS:XaUR
n[
UR
X$5nURUR5 URU5nUSS:�a
Sn[U5eUSS:wa
Sn[U5eg)z�
Loads this image with pixel data from a bytes object.

This method is similar to the :py:func:`~PIL.Image.frombytes` function,
but loads data into this image instead of creating a new image object.
rNrr�r!znot enough image datazcannot decode image data)r�r�r�r�r�r�r�r�r6�decoderA)r�r�r�r��decoder_args�d�sr�s        r)r��Image.frombytesMs����:�:��?�d�k�k�Q�.�� ���|���!�j��a��%�&H�&H�'��?�L��5� �\�R�%7��9�9�L�
��	�	�<�>��	�
�
�4�7�7��
�H�H�T�N���Q�4�1�9�)�C��S�/�!��Q�4�1�9�,�C��S�/�!�r(c��URGb�UR(GayURR(Ga]URR5upURRURRX5 SURlSURlSUR;a�US;a�[URS[5(a*URRURSS5 O(URRURS5 SURlOSURRURRURR5URlURb%URRUR5$g)a
Allocates storage for the image and loads the pixel data.  In
normal cases, you don't need to call this method, since the
Image class automatically loads an opened image when it is
accessed for the first time.

If the file associated with the image was opened by Pillow, then this
method will close it. The exception to this is if the image has
multiple frames, in which case the file will be left open for seek
operations. See :ref:`file-handling` for more information.

:returns: An image access object.
:rtype: :py:class:`.PixelAccess`
Nr�transparency�r�r�r�)rr�dirtyrr6r�r��rawmoderr��int�putpalettealpha�putpalettealphasre�pixel_accessr)r�r��arrs   r)rM�
Image.loadrs8���8�8��D�L�L�L�T�\�\�5G�5G�5G����,�,�.�I�D��G�G���t�|�|�0�0�$�<�!"�D�L�L��#'�D�L�L� �����*�t�|�/C��d�i�i��7��=�=��G�G�+�+�D�I�I�n�,E�q�I��G�G�,�,�T�Y�Y�~�-F�G�$*����!�'+�w�w�'9�'9��L�L�%�%�t�|�|�'8�'8�(����$��8�8���7�7�'�'��
�
�6�6�r(c��g)a;
Verifies the contents of a file. For data read from a file, this
method attempts to determine if the file is broken, without
actually decoding the image data.  If this method finds any
problems, it raises suitable exceptions.  If you need to load
the image after using this method, you must reopen the image
file.
Nr!r�s r)�verify�Image.verify�s��	
r(�c	�^^^�US;a[US5 UR5 SUR;nU(dIURS:Xa9UR(aURRnOSnUS:Xa	U(aSnU(aXR:XaT(dUR5$T(a�US;a
Sn[
U5eURRUT5nURU5n	U(a�URRS	:XarU	RSmS$S
jmUS:Xa
T"TT5mO9[U5S	:Xa*[UUU4Sj[S
[T5555mTU	RS'U	$US:Xa!URS:XaURU5$Sn
SnU(GaYURS;aUS;dURS:XaLUS;aFURURRXRS55n	U	RS	U	$URS;Ga?US;Ga8URSn[!U["5(a[$R&"S5 SnGO�[)URS5n
URS:Xa�URceU
R+URURR5 [!U[5(a-SnU
RceU
RR-X�5nUcSn
O�U
R1SU5 US;aU
R3U5n
OU
R3S5n
U
R5S5n
O�URS:Xa�US;a�URSnSn[!U["5(aURR7U5 O?[!U[85(aURR;US
5 O
Sn[
U5eUS:Xa�U[<R>:Xa�URRU5nURU5n	SSK J!n URB"SU	RRES55U	lU(a
U	RS	U
bCU	RR-[G[[8S4U
5U	5U	RS'U	$U	$S URU4;a�UnUS :Xa.URS!;aUR3S5nURnOUnUS!;auSS"K J%n URMS#5nURMS 5nURS :XaUU/OUU/nUROUS
USURU5nURQU5$Uc[RRTnURR3X5nURU5n	US:XaAU[<R>:wa-SSK J!n URB"SURES55U	lU(a
U	RS	U
brU	RS:XaTU	R(aCU	RR-[G[[8S4U
5U	5U	RS'U	$X�RS'U	$![a(n[/U5S:XaSnSnAGN�[
U5UeSnAff=f![Ha' U	RS	[$R&"S5 U	$f=f![aw [WUR5nUUR:XaeURR3U5nUR3X5nGN�![XanSn[
U5UeSnAff=ff=f![a=nU	RS	[/U5S:wa[$R&"S5 SnAU	$SnAff=f)%a�
Returns a converted copy of this image. For the "P" mode, this
method translates pixels through the palette.  If mode is
omitted, a mode is chosen so that all information in the image
and the palette can be represented without a palette.

This supports all possible conversions between "L", "RGB" and "CMYK". The
``matrix`` argument only supports "L" and "RGB".

When translating a color image to grayscale (mode "L"),
the library uses the ITU-R 601-2 luma transform::

    L = R * 299/1000 + G * 587/1000 + B * 114/1000

The default method of converting a grayscale ("L") or "RGB"
image into a bilevel (mode "1") image uses Floyd-Steinberg
dither to approximate the original image luminosity levels. If
dither is ``None``, all values larger than 127 are set to 255 (white),
all other values to 0 (black). To use other thresholds, use the
:py:meth:`~PIL.Image.Image.point` method.

When converting from "RGBA" to "P" without a ``matrix`` argument,
this passes the operation to :py:meth:`~PIL.Image.Image.quantize`,
and ``dither`` and ``palette`` are ignored.

When converting from "PA", if an "RGBA" palette is present, the alpha
channel from the image will be used instead of the values from the palette.

:param mode: The requested mode. See: :ref:`concept-modes`.
:param matrix: An optional conversion matrix.  If given, this
   should be 4- or 12-tuple containing floating point values.
:param dither: Dithering method, used when converting from
   mode "RGB" to "P" or from "RGB" or "L" to "1".
   Available methods are :data:`Dither.NONE` or :data:`Dither.FLOYDSTEINBERG`
   (default). Note that this is not used when ``matrix`` is supplied.
:param palette: Palette to use when converting from mode "RGB"
   to "P".  Available palettes are :data:`Palette.WEB` or
   :data:`Palette.ADAPTIVE`.
:param colors: Number of colors to use for the :data:`Palette.ADAPTIVE`
   palette. Defaults to 256.
:rtype: :py:class:`~PIL.Image.Image`
:returns: An :py:class:`~PIL.Image.Image` object.
�zBGR;15zBGR;16zBGR;24r5r�r�r�r�)r�r�zillegal conversionr>c	��USUS-USUS--USUS--USS--n[S[S[U555$)Nrrr=r>rZ�)r��minr�)r��v�values   r)�convert_transparency�+Image.convert.<locals>.convert_transparency�s\���a�D�1�Q�4�K�!�A�$��1��+�5��!��q��t��C�a��d�S�j�P�E��q�#�c�3�u�:�"6�7�7r(r�c3�N># �UHnT"TUS-US-S-T5v� M g7f)r?Nr!)�.0�ir��matrixr�s  ���r)�	<genexpr>� Image.convert.<locals>.<genexpr>�s5����)�!<�A�-�V�A��E�A��E�A�I�-F��U�U�!<�s�"%rNF)r�r�r�r��r�r�)r�r�r�r�)r�r�r�zVPalette images with Transparency expressed in bytes should be converted to RGBA imagesT�rrz2Couldn't allocate a palette color for transparencyz$cannot allocate more than 256 colorsr�r�r�r�z.Transparency for P mode should be bytes or intrr4.z0Couldn't allocate palette entry for transparencyr�)r�r�r�)�ImageCms�sRGB)r�ztuple[float, ...]r�ztuple[int, int, int]rr�)-rrMrr�rr5rAr6�convert_matrixr7r�r�r��range�quantize�convert_transparentr��bytes�warnings�warnr6r��getcolor�str�putpixel�convert�getpixelr�r�r�rerhr�rurerrJr��
createProfile�buildTransform�applyr^rcr�r�)r�r�r��ditherr�colors�has_transparencyr�r6�new_im�trns�delete_trnsr8�trns_im�errr�ru�
other_moder��srgb�lab�profiles�	transform�modebaser�r�s  `                     @@r)r��
Image.convert�s����h�1�1��d�B���	�	��)�T�Y�Y�6����	�	�S�(��|�|��|�|�(�(�����u�}�!1�����	�	�)�&��9�9�;����<�'�*�� ��o�%����'�'��f�5�B��Y�Y�r�]�F��D�G�G�M�M�Q�$6�%�{�{�>�:��8�(�8�-A�8��8��3�;�#7���#M�L���Y�!�^�#(�)�!&�q�#�l�*;�!<�)�$�L�/;����N�+��M��3�;�4�9�9��.��=�=��(�(�������	�	�4�4���9O��	�	�U�"�t�/K�'K�����G�G�/�/��i�i��6O�P����K�K��/��
����/�/�D�<M�4M��I�I�n�-���a��'�'��M�M�3��#'�K�"�$�)�)�V�4�G��y�y�C�'�#�|�|�7�7�7��*�*�4�<�<����9J�9J�K�%�a��/�/�"V�C�#*�?�?�#>�>�#>�A�$+�O�O�$<�$<�Q�$E���y�#���(�(���3��<�/�&-�o�o�d�&;�G�'.�o�o�e�&<�G�&�/�/��7�����c�!�d�.B�&B��I�I�n�-��"���a��'�'��G�G�,�,�Q�/���3�'�'��G�G�+�+�A�q�1�J�C�$�S�/�)��3�;�7�g�&6�&6�6����!�!�&�)�B��Y�Y�r�]�F�&�)�6�6��v�y�y�+�+�E�2��F�N���K�K��/���	V�28�.�.�2I�2I��U�3��8�_�d�3��3�F�K�K��/��M�6�M��T�Y�Y��%�%��B��u�}��7�7�"9�9����F�+�B��W�W�
�!�
��4�4�&��-�-�f�5���,�,�U�3��*,�'�'�U�*:�C��;��s���$�3�3��Q�K��!��b�g�g�t��	�!���r�*�*��>��*�*�F�	-�������.�B����2����3�;�7�g�&6�&6�6�&�)�6�6�u�b�m�m�E�>R�S�F�N�����N�+����{�{�c�!�f�n�n��28�.�.�2I�2I��U�3��8�_�d�3�V�3�F�K�K��/��
�/3���N�+��
��m$.�A�#&�q�6�-S�#S�)-�A�*4�S�/�q�$@��
A��d!�V����N�3��M�M�"T�U��M�V��@�
	-�	
-�&�t�y�y�1���t�y�y�(���W�W�_�_�X�.���Z�Z��-����
-�*�� ��o�1�,��
-��
	-��4"�����N�3��1�v�!G�G�!�
�
�N���
�
���su�[
�/A[?�\3�8A^7�

[<�[7�+[7�7[<�?-\0�/\0�3
^4�>A^�
^0�^+�+^0�0^4�7
_>�2_9�9_>rc��UR5 Uc0[RnURS:Xa[RnURS:Xa1U[R[R
4;a
Sn[
U5eU(a�UR5 URS:wa
Sn[
U5eURS;a
Sn[
U5eURRSXTR5nURU5nURceURR5Ul
U$US:a
S	n[
U5eURURRXU55nS
SK
Jn	 URR5n
URR!X�5SU[#U
5-nU	R"X�5Ul
U$)a�
Convert the image to 'P' mode with the specified number
of colors.

:param colors: The desired number of colors, <= 256
:param method: :data:`Quantize.MEDIANCUT` (median cut),
               :data:`Quantize.MAXCOVERAGE` (maximum coverage),
               :data:`Quantize.FASTOCTREE` (fast octree),
               :data:`Quantize.LIBIMAGEQUANT` (libimagequant; check support
               using :py:func:`PIL.features.check_feature` with
               ``feature="libimagequant"``).

               By default, :data:`Quantize.MEDIANCUT` will be used.

               The exception to this is RGBA images. :data:`Quantize.MEDIANCUT`
               and :data:`Quantize.MAXCOVERAGE` do not support RGBA images, so
               :data:`Quantize.FASTOCTREE` is used by default instead.
:param kmeans: Integer greater than or equal to zero.
:param palette: Quantize to the palette of given
                :py:class:`PIL.Image.Image`.
:param dither: Dithering method, used when converting from
   mode "RGB" to "P" or from "RGB" or "L" to "1".
   Available methods are :data:`Dither.NONE` or :data:`Dither.FLOYDSTEINBERG`
   (default).
:returns: A new image
Nr�zoFast Octree (method == 2) and libimagequant (method == 3) are the only valid methods for quantizing RGBA imagesr�zbad mode for palette image>r�r�z7only RGB or L mode images can be quantized to a paletterzkmeans must not be negativerr4)rMrjrlr�rnrorAr6r�r7rr5r�r�ru�getpalettemoderer�)r�r��method�kmeansrr�r�r6r�rur��palette_datas            r)r��Image.quantize�s���F	
�	�	���>��'�'�F��y�y�F�"�!�,�,���9�9���6�����"�"�2
�$
�H�
��S�/�!���L�L�N��|�|�s�"�2�� ��o�%��y�y��,�O�� ��o�%�������f�j�j�9�B��Y�Y�r�]�F��?�?�.�.�.�$�_�_�1�1�3�F�N��M��A�:�/�C��S�/�!�
�Y�Y�t�w�w�'�'���?�
@��"��u�u�#�#�%���u�u�'�'��3�4H�f�s�4�y�6H�I��!�.�.�t�B��
��	r(c�t�UR5 URURR55$)z�
Copies this image. Use this method if you wish to paste things
into an image, but still retain the original.

:rtype: :py:class:`~PIL.Image.Image`
:returns: An :py:class:`~PIL.Image.Image` object.
)rMr7r6r5r�s r)r5�
Image.copy�s&��	
�	�	���y�y�������(�(r(c��UcUR5$USUS:a
Sn[U5eUSUS:a
Sn[U5eUR5 URUR	UR
U55$)ax
Returns a rectangular region from this image. The box is a
4-tuple defining the left, upper, right, and lower pixel
coordinate. See :ref:`coordinate-system`.

Note: Prior to Pillow 3.4.0, this was a lazy operation.

:param box: The crop rectangle, as a (left, upper, right, lower)-tuple.
:rtype: :py:class:`~PIL.Image.Image`
:returns: An :py:class:`~PIL.Image.Image` object.
r=rz&Coordinate 'right' is less than 'left'r>rz'Coordinate 'lower' is less than 'upper')r5rArMr7�_cropr6)r��boxr�s   r)�crop�
Image.crop�sx���;��9�9�;���q�6�C��F�?�:�C��S�/�!�
��V�c�!�f�_�;�C��S�/�!��	�	���y�y����D�G�G�S�1�2�2r(c��[[[[U55up4pV[XS-
5[Xd-
54n[	U5 URX4XV45$)a%
Returns a rectangular region from the core image object im.

This is equivalent to calling im.crop((x0, y0, x1, y1)), but
includes additional sanity checks.

:param im: a core image object
:param box: The crop rectangle, as a (left, upper, right, lower)-tuple.
:returns: A core image object.
)rIr��round�abs�_decompression_bomb_checkr)r�r6r�x0�y0�x1�y1�absolute_valuess        r)r��Image._cropsL���S�#�e�S�/�2�����r�w�<��R�W��6��!�/�2��w�w���'�(�(r(c��g)a�
Configures the image file loader so it returns a version of the
image that as closely as possible matches the given mode and
size. For example, you can use this method to convert a color
JPEG to grayscale while loading it.

If any changes are made, returns a tuple with the chosen ``mode`` and
``box`` with coordinates of the original image within the altered one.

Note that this method modifies the :py:class:`~PIL.Image.Image` object
in place. If the image has already been loaded, this method has no
effect.

Note: This method is not implemented for most images. It is
currently implemented only for JPEG and MPO images.

:param mode: The requested mode.
:param size: The requested size in pixels, as a 2-tuple:
   (width, height).
Nr!)r�r�r(s   r)�draft�Image.draft.s��.	
r(c��UcUnUR5 URURRX55$r�)rMr7r6�expand)r��xmargin�ymargins   r)�_expand�
Image._expandGs1���?��G��	�	���y�y�������9�:�:r(c
�X�SSKJn UR5 [U5(aU"5n[	US5(d
Sn[U5e[
XR5nURRS:XdU(a*URURUR55$[URR5Vs/sH;oPRURURRU555PM= nn[URU5$s snf)z�
Filters this image using the given filter.  For a list of
available filters, see the :py:mod:`~PIL.ImageFilter` module.

:param filter: Filter kernel.
:returns: An :py:class:`~PIL.Image.Image` object.r)rt�filterz>filter argument should be ImageFilter.Filter instance or class)r�rtrM�callabler7�	TypeErrorr��MultibandFilterr6r�r7rr��getband�merger�)r�rrtr��	multiband�c�imss       r)r�Image.filterMs���	"��	�	���F����X�F��v�x�(�(�R�C��C�.� ��v�'B�'B�C�	��7�7�=�=�A����9�9�V�]�]�4�7�7�3�4�4�CH����
�
�BV�
�BV�Q�I�I�f�m�m�D�G�G�O�O�A�$6�7�8�BV�	�
��T�Y�Y��$�$��
s�
AD'c�V�[R"UR5R$)z�
Returns a tuple containing the name of each band in this image.
For example, ``getbands`` on an RGB image returns ("R", "G", "B").

:returns: A tuple containing band names.
:rtype: tuple
)rr�r�r�r�s r)�getbands�Image.getbandshs��� � ����+�1�1�1r()�
alpha_onlyc�X�UR5 URRU5$)a�
Calculates the bounding box of the non-zero regions in the
image.

:param alpha_only: Optional flag, defaulting to ``True``.
   If ``True`` and the image has an alpha channel, trim transparent pixels.
   Otherwise, trim pixels when all channels are zero.
   Keyword-only argument.
:returns: The bounding box is returned as a 4-tuple defining the
   left, upper, right, and lower pixel coordinate. See
   :ref:`coordinate-system`. If the image is completely empty, this
   method returns None.

)rMr6�getbbox)r�r$s  r)r&�
Image.getbboxrs �� 	
�	�	���w�w���z�*�*r(c�.�UR5 URS;aVURR5n[	S5Vs/sHo2U(dMX#U4PM nn[U5U:�agU$URR
U5$s snf)a�
Returns a list of colors used in this image.

The colors will be in the image's mode. For example, an RGB image will
return a tuple of (red, green, blue) color values, and a P image will
return the index of the color in the palette.

:param maxcolors: Maximum number of colors.  If this number is
   exceeded, this method returns None.  The default limit is
   256 colors.
:returns: An unsorted list of (count, pixel) values.
)r�r�r�r�N)rMr�r6�	histogramr�r��	getcolors)r��	maxcolors�hr��outs     r)r*�Image.getcolors�s~�� 	
�	�	���9�9��'����!�!�#�A�?D�S�z�+R�z�!�q�T�I�Q�T�1�I�z�C�+R��3�x�)�#���J��w�w� � ��+�+��	,Ss�
B�
Bc�v�UR5 UbURRU5$UR$)a}
Returns the contents of this image as a sequence object
containing pixel values.  The sequence object is flattened, so
that values for line one follow directly after the values of
line zero, and so on.

Note that the sequence object returned by this method is an
internal PIL data type, which only supports certain sequence
operations.  To convert it to an ordinary sequence (e.g. for
printing), use ``list(im.getdata())``.

:param band: What band to return.  The default is to return
   all bands.  To return a single band, pass in the index
   value (e.g. 0 to get the "R" band from an "RGB" image).
:returns: A sequence-like object.
)rMr6r)r��bands  r)r�
Image.getdata�s/��$	
�	�	�����7�7�?�?�4�(�(��w�w�r(c��^�TR5 TRRS:�a2[U4Sj[	TRR555$TRR5$)z�
Gets the minimum and maximum pixel values for each band in
the image.

:returns: For a single-band image, a 2-tuple containing the
   minimum and maximum pixel value.  For a multi-band image,
   a tuple containing one 2-tuple for each band.
rc3�v># �UH.nTRRU5R5v� M0 g7fr�)r6r�
getextrema)r�r�r�s  �r)r��#Image.getextrema.<locals>.<genexpr>�s,����W�BV�Q�������+�6�6�8�8�BV�s�69)rMr6r�r�r�r4r�s`r)r4�Image.getextrema�sO���	
�	�	���7�7�=�=�1���W�%����
�
�BV�W�W�W��w�w�!�!�#�#r(c�^^�SSjmSUU4Sjjm[c[R"S5 0$SUR;a0$[R"URSRS55nT"UR5T"U50$)zy
Returns a dictionary containing the XMP tags.
Requires defusedxml to be installed.

:returns: XMP tags in a dictionary.
c�2�[R"SSU5$)Nz^{[^}]+}r�)�re�sub)�tags r)�get_name�Image.getxmp.<locals>.get_name�s���6�6�*�b�#�.�.r(c��>�URR5VVs0sHupT"U5U_M nnn[U5nU(aaUHYnT"UR5nT	"U5nXc;a3[	X6[5(dX6/X6'X6RU5 MUXsU'M[ U$U(a"UR(aURUS'U$UR$s snnf)Nrr)�attrib�items�listr;r�r�rr)
�element�kr�r��children�childr��child_valuer<�	get_values
        ��r)rG�Image.getxmp.<locals>.get_value�s����@G���@T�@T�@V�$W�@V���X�a�[�!�^�@V�E�$W��G�}�H��%�E�#�E�I�I�.�D�"+�E�"2�K��}�)�%�+�t�<�<�+0�;�-�E�K���*�*�;�7�&1�d��&��L���<�<�$+�L�L�E�&�M��L��|�|�#��!%Xs�Cz5XMP data cannot be read without defusedxml dependency�xmp�)r;r�rr�)rBrqrzstr | dict[str, Any] | None)rr�r�r�
fromstring�rstripr;)r��rootr<rGs  @@r)�getxmp�Image.getxmp�sy���	/�	�	�(���M�M�Q�R��I���	�	�!��I��%�%�d�i�i��&6�&=�&=�g�&F�G������"�I�d�O�4�4r(c�D�URc[5UlO'URR(aUR$SURlURR	S5nUc�SUR;aD[
R
SRURSRS5SS55nO�[US5(a�URRURlURRURlURRUR URR"5 UbURR%U5 [&R(R*UR;asURR	S	5nU(aQ[,R."S
U5nU(a3[1US5UR[&R(R*'UR$)zR
Gets EXIF data from the image.

:returns: an :py:class:`~PIL.Image.Exif` object.
NT�exifzRaw profile type exifr�r�r>�tag_v2zXML:com.adobe.xmpztiff:Orientation(="|>)([0-9])r=)r�Exif�_loadedr�getr��fromhexr��splitr7rR�_bigtiff�bigtiff�_endian�endian�load_from_fpr?�_offsetrMr�Base�Orientationr9�searchr�)r��	exif_info�xmp_tags�matchs    r)�getexif�
Image.getexif�ss���:�:����D�J�
�Z�Z�
�
��:�:��!��
�
���I�I�M�M�&�)�	���&�$�)�)�3�!�M�M��G�G�D�I�I�&=�>�D�D�T�J�1�2�N�O��	���x�(�(�%)�[�[�%9�%9��
�
�"�$(�K�K�$7�$7��
�
�!��
�
�'�'�������1D�1D�E�� ��J�J�O�O�I�&��=�=�$�$�D�J�J�6��y�y�}�}�%8�9�H���	�	�"B�H�M���<?��a��M�D�J�J�x�}�}�8�8�9��z�z�r(c��URbURR(dgSURlUR5 grc)rrTrdr�s r)�_reload_exif�Image._reload_exifs0���:�:��T�Z�Z�%7�%7��"��
�
�����r(c�z�/nUR5n/n[RRU;agU[RRnU(aC[	U[
5(dU4nUH%nUR
URU5U45 M' UR[RR5nU(acUR[RR5(a5URceUR
XbRR45 SnUGHTup�URR!5n
UcU
nURnUb�UR[RR5nUb�U[#USS5-
nURR%U5 URR'UR[RR(55n
[*R,"U
5n[/U5nSSKJn Wc3[	X�R45(aU	/UlUR9S5 UR;5 UR
U5 SSS5 GMW UbURR%U5 U$!,(df   GM�=f)N�_exif_offsetrr�rw)rdrr^�SubIFDsr�r�r��
_get_ifd_dict�get_ifd�IFD�IFD1rU�JpegIFOffset�_info�nextr?�tellr��seek�read�JpegIFByteCountrxry�openr�rw�
TiffImageFile�
_frame_pos�_seekrM)r��child_imagesrQ�ifds�subifd_offsets�
subifd_offset�ifd1r��ifd�
ifd_offset�current_offsetr?�thumbnail_offsetr�r6rws                r)�get_child_images�Image.get_child_imagess�����|�|�~�����=�=� � �D�(�!�(�-�-�"7�"7�8�N��!�.�%�8�8�&4�%6�N�%3�M��K�K��!3�!3�M�!B�M� R�S�&4��|�|�H�L�L�-�-�.���D�H�H�X�]�]�7�7�8�8��:�:�)�)�)��K�K��z�z���/�0���#�O�C�!�W�W�\�\�^�N��~�'�����B���#&�7�7�8�=�=�+E�+E�#F� �#�/�$���n�a�(H�H�$��G�G�L�L�!1�2��7�7�<�<�����
�
�0M�0M�(N�O�D����D�)�B��b��R�-�#�+�
��5�5�1�1�&0�L�B�M��H�H�Q�K����	��#�#�B�'��� $�2���G�G�L�L�� �����s
�AJ*�*
J:	c�N�UR5 URR$)zZ
Returns a capsule that points to the internal image memory.

:returns: A capsule object.
)rMr6�ptrr�s r)�getim�Image.getimBs��	
�	�	���w�w�{�{�r(c���UR5 URR5nUcUn[	URRX!55$![a gf=f)a
Returns the image palette as a list.

:param rawmode: The mode in which to return the palette. ``None`` will
   return the palette in its current mode.

   .. versionadded:: 9.1.0

:returns: A list of color values [r, g, b, ...], or None if the
   image has no palette.
N)rMr6r�rArAre)r�r�r�s   r)re�Image.getpaletteLs^��	
�	�	��	��7�7�)�)�+�D��?��G��D�G�G�&�&�t�5�6�6��	�	��	�s�A�
A"�!A"c���URS;dSUR;agURS:Xa4URceURRRS5$g)a
Determine if an image has transparency data, whether in the form of an
alpha channel, a palette with an alpha channel, or a "transparency" key
in the info dictionary.

Note the image might still appear solid, if all of the values shown
within are opaque.

:returns: A boolean.
)r�r�r�r�r�r�Tr��AF)r�rrrXr�s r)�has_transparency_data�Image.has_transparency_databsZ��
�I�I�;�;�����*���9�9����<�<�+�+�+��<�<�$�$�-�-�c�2�2�r(c��URS:wdSUR;agSSKJn UR	S5nUceURSn[U[5(a[U5HupEXRUS-S-'M O
S	X#S-S-'UR"S[
U55UlSURl	URS	g)
z�
If a P mode image has a "transparency" key in the info dictionary,
remove the key and instead apply the transparency to the palette.
Otherwise, the image is unchanged.
r�r�Nrr4r�r?r>r)
r�rr�rurer�r��	enumeraterr�)r�rurr�r��alphas      r)�apply_transparency�Image.apply_transparencyxs����9�9���~�T�Y�Y�>��"��/�/�&�)���"�"�"��y�y��0���l�E�*�*�%�l�3���%*��A���	�"�4�-.�G�1�$�q�(�)�#�0�0���w��H���������I�I�n�%r(c�j�UR5 URR[U55$)z�
Returns the pixel value at a given position.

:param xy: The coordinate, given as (x, y). See
   :ref:`coordinate-system`.
:returns: The pixel value.  If the image is a multi-layer image,
   this method returns a tuple.
)rMr6r�r�)r��xys  r)r��Image.getpixel�s&��	
�	�	���w�w����b�	�*�*r(c��UR5 URR5up[U5[U54$)z�
Get projection to x and y axes

:returns: Two sequences, indicating where there are non-zero
    pixels along the X-axis and the Y-axis, respectively.
)rMr6�
getprojectionrA)r�rl�ys   r)r��Image.getprojection�s4��	
�	�	���w�w�$�$�&����A�w��Q���r(c�T�UR5 U(a6UR5 URRSUR5$URS;a2URRUbU5$UR	55$URR5$)aN
Returns a histogram for the image. The histogram is returned as a
list of pixel counts, one for each pixel value in the source
image. Counts are grouped into 256 bins for each band, even if
the image has more than 8 bits per band. If the image has more
than one band, the histograms for all bands are concatenated (for
example, the histogram for an "RGB" image contains 768 values).

A bilevel image (mode "1") is treated as a grayscale ("L") image
by this method.

If a mask is provided, the method returns a histogram for those
parts of the image where the mask image is non-zero. The mask
image must have the same size as the image, and be either a
bi-level image (mode "1") or a grayscale image ("L").

:param mask: An optional mask.
:param extrema: An optional tuple of manually-specified extrema.
:returns: A list containing pixel counts.
r�r�r�)rMr6r)r�r4�r��mask�extremas   r)r)�Image.histogram�s���.	
�	�	����I�I�K��7�7�$�$�V�T�W�W�5�5��9�9�
�"��7�7�$�$�"�.���
�48�O�O�4E��
��w�w� � �"�"r(c�T�UR5 U(a6UR5 URRSUR5$URS;a2URRUbU5$UR	55$URR5$)a
Calculates and returns the entropy for the image.

A bilevel image (mode "1") is treated as a grayscale ("L")
image by this method.

If a mask is provided, the method employs the histogram for
those parts of the image where the mask image is non-zero.
The mask image must have the same size as the image, and be
either a bi-level image (mode "1") or a grayscale image ("L").

:param mask: An optional mask.
:param extrema: An optional tuple of manually-specified extrema.
:returns: A float value representing the image entropy
rr�)rMr6�entropyr�r4r�s   r)r��
Image.entropy�s���$	
�	�	����I�I�K��7�7�?�?�6�4�7�7�3�3��9�9�
�"��7�7�?�?�"�.���
�48�O�O�4E��
��w�w��� � r(c��[U[5(aUb
Sn[U5eUnSnUcSn[U5S:Xai[U[5(a
URnO/[U[5(a
URnO
Sn[U5eX"SUS-USUS-4-
n[U[
5(a"SSKJn URXR5nO�[U[5(arUR5 URUR:wa;URS	:wdURS
;aURUR5nURnOUnUR5 U(a7UR5 URRXrUR5 gURRXr5 g)a�
Pastes another image into this image. The box argument is either
a 2-tuple giving the upper left corner, a 4-tuple defining the
left, upper, right, and lower pixel coordinate, or None (same as
(0, 0)). See :ref:`coordinate-system`. If a 4-tuple is given, the size
of the pasted image must match the size of the region.

If the modes don't match, the pasted image is converted to the mode of
this image (see the :py:meth:`~PIL.Image.Image.convert` method for
details).

Instead of an image, the source can be a integer or tuple
containing pixel values.  The method then fills the region
with the given color.  When creating RGB images, you can
also use color strings as supported by the ImageColor module.

If a mask is given, this method updates only the regions
indicated by the mask. You can use either "1", "L", "LA", "RGBA"
or "RGBa" images (if present, the alpha band is used as mask).
Where the mask is 255, the given image is copied as is.  Where
the mask is 0, the current value is preserved.  Intermediate
values will mix the two images together, including their alpha
channels if they have them.

See :py:meth:`~PIL.Image.Image.alpha_composite` if you want to
combine images with respect to their alpha channels.

:param im: Source image or pixel value (integer, float or tuple).
:param box: An optional 4-tuple giving the region to paste into.
   If a 2-tuple is used instead, it's treated as the upper left
   corner.  If omitted or None, the source is pasted into the
   upper left corner.

   If an image is given as the second argument and there is no
   third, the box defaults to (0, 0), and the second argument
   is interpreted as a mask image.
:param mask: An optional mask image.
Nz=If using second argument as mask, third argument must be Nonerr=z,cannot determine region size; use 4-item boxrr��
ImageColorr�)r�r�r�)r�r�rAr�r(r�r�r�r�r�rMr�r6rQ�paste)r�r6rr�r�r(r��sources        r)r��Image.paste�sm��Z�c�5�!�!���U�� ��o�%��D��C��;��C��s�8�q�=��"�e�$�$��w�w���D�%�(�(��y�y��E�� ��o�%���F�T�!�W�$�c�!�f�t�A�w�&6�7�7�C��b�#���$��(�(��Y�Y�7�F�
��E�
"�
"��G�G�I��y�y�B�G�G�#��9�9��%����8N�)N����D�I�I�.�B��U�U�F��F�������I�I�K��G�G�M�M�&�t�w�w�/��G�G�M�M�&�&r(c���[U[[45(d
Sn[U5e[U[[45(d
Sn[U5e[	U5S:Xa[U5nO5[	U5S:Xa[U5UR
-nO
Sn[U5e[	U5S:Xd
Sn[U5e[
U5S:a
Sn[U5eUS	UR
-:XaUnOURU5n[U5USUR-US
UR-4-nUS	UR
-:XaUnOURU5n[X�5n	URX�5 g)a�'In-place' analog of Image.alpha_composite. Composites an image
onto this image.

:param im: image to composite over this one
:param dest: Optional 2 tuple (left, top) specifying the upper
  left corner in this (destination) image.
:param source: Optional 2 (left, top) tuple for the upper left
  corner in the overlay source image, or 4 tuple (left, top, right,
  bottom) for the bounds of the source rectangle

Performance Note: Not currently implemented in-place in the core layer.
zSource must be a list or tuplez#Destination must be a list or tupler?r=z*Source must be a sequence of length 2 or 4z*Destination must be a sequence of length 2rzSource must be non-negativerrN)r�rAr�rAr�r(r�rr�r��alpha_compositer�)
r�r6�destr�r��overlay_crop_box�overlayr�
background�results
          r)r��Image.alpha_compositeCsM�� �&�4��-�0�0�2�C��S�/�!��$��u�
�.�.�7�C��S�/�!��v�;�!��$�V�}��
��[�A�
�$�V�}�r�w�w�6��>�C��S�/�!��4�y�A�~�>�C��S�/�!��v�;��?�/�C��S�/�!��v����/�/��G��g�g�.�/�G��D�k�T�!�W�w�}�}�4�d�1�g����6N�O�O���&�4�9�9�$�$��J����3��J� ��5���
�
�6�r(c�v�UR5 [U[5(aURU5$[	U5(a�UR
S;a7[
U5up4URURRX455$[S5Vs/sH
oQ"U5PM snURR-nOUnUR
S:Xa
Sn[U5eUS:waUVs/sHn[U5PM nnURURRXb55$s snfs snf)a?
Maps this image through a lookup table or function.

:param lut: A lookup table, containing 256 (or 65536 if
   self.mode=="I" and mode == "L") values per band in the
   image.  A function can be used instead, it should take a
   single argument. The function is called once for each
   possible pixel value, and the resulting table is applied to
   all bands of the image.

   It may also be an :py:class:`~PIL.Image.ImagePointHandler`
   object::

       class Example(Image.ImagePointHandler):
         def point(self, im: Image) -> Image:
           # Return result
:param mode: Output mode (default is same as input). This can only be used if
   the source image has mode "L" or "P", and the output has mode "1" or the
   source image mode is "I" and the output mode is "L".
:returns: An :py:class:`~PIL.Image.Image` object.
)r�r�r�r�r�z+point operation not supported for this mode)rMr��ImagePointHandler�pointrr�rr7r6�point_transformr�r�rAr)r��lutr�r�r�r��flatLutr�s        r)r��Image.point{s���B	
�	�	���c�,�-�-��9�9�T�?�"��C�=�=��y�y�.�.�!0�� 4�
���y�y����!8�!8��!G�H�H�',�S�z�2�z�!�s�1�v�z�2�T�W�W�]�]�B�G��G��9�9���?�C��S�/�!��3�;�)0�1��A�u�Q�x��G�1��y�y������w�5�6�6��3��2s�D1�0D6c��UR5 URS;aP[UR5S-nURR	U5 URRUlURS;aSnOSn[U[5(aOURS	;a
Sn[
U5eUR5 URS
:XaURS5nOURRXa5 gURR!URU5 g![
[4aJnURRU5nURS;aSn[
U5UeX@lSnAGN-SnAff=f![anSn[
U5UeSnAff=f![
[4a [SURU5nN�f=f)a*
Adds or replaces the alpha layer in this image.  If the image
does not have an alpha layer, it's converted to "LA" or "RGBA".
The new layer must be either "L" or "1".

:param alpha: The new alpha layer.  This can either be an "L" or "1"
   image having the same size as this image, or an integer.
r�r�z alpha channel could not be addedN�illegal image moder�rr>)r�r�r�r�)rQr�r�r6�setmoder�rAr�rr�r�r�rM�fillbandr6r(�putband)r�r�r�r�r6r�r0s       r)�putalpha�Image.putalpha�s���	
�����9�9�0�0�
-�"�4�9�9�-��3��!��G�G�O�O�D�)�"�W�W�\�\��
�
�9�9��$��D��D��e�U�#�#��z�z��+�*�� ��o�%��J�J�L��z�z�S� ��
�
�c�*���
���� � ��-�
���������$�'��G'�
�3�!�������.�B��w�w�&:�:�@��(��o�1�4� �G�G��
!���
-�*�� ��o�1�,��
-��*#�J�/�
3��C����E�2��
3�sR�F�D.�F�+F+�.F�>?F�=F�F�F�
F(�F#�#F(�+'G�Gc�\�UR5 URRXU5 g)a,
Copies pixel data from a flattened sequence object into the image. The
values should start at the upper left corner (0, 0), continue to the
end of the line, followed directly by the first value of the second
line, and so on. Data will be read until either the image or the
sequence ends. The scale and offset values are used to adjust the
sequence values: **pixel = value*scale + offset**.

:param data: A flattened sequence object.
:param scale: An optional scale value.  The default is 1.0.
:param offset: An optional offset value.  The default is 0.0.
N)rQr6�putdata)r�r�r�r�s    r)r��
Image.putdata�s"��&	
����������V�,r(c� �SSKJn URS;a
Sn[U5e[	XR5(aWUR
b(UR"UR
UR5nOTUR"URS9nSUlO2[	U[5(d[U5nUR"X!5nSUR;aSOS	Ul
XPlSU;aS
OSURlUR5 g)a

Attaches a palette to this image.  The image must be a "P", "PA", "L"
or "LA" image.

The palette sequence must contain at most 256 colors, made up of one
integer value for each channel in the raw mode.
For example, if the raw mode is "RGB", then it can contain at most 768
values, made up of red, green and blue values for the corresponding pixel
index in the 256 colors.
If the raw mode is "RGBA", then it can contain at most 1024 values,
containing red, green, blue and alpha values.

Alternatively, an 8-bit string may be used instead of an integer sequence.

:param data: A palette sequence (either a list or a string).
:param rawmode: The raw mode of the palette. Either "RGB", "RGBA", or a mode
   that can be transformed to "RGB" or "RGBA" (e.g. "R", "BGR;15", "RGBA;L").
rr4r�r�N�rr�r�r�r�r�)r�rur�rAr�r�r�rr�r�rrM)r�r�r�rur�rs      r)r��Image.putpalettes���.	#��9�9�2�2�&�C��S�/�!��d�5�5�6�6��|�|�'�&�*�*�4�<�<����F��&�3�3�D�L�L�I�� !��
��d�E�*�*��T�{��"�&�&�w�5�G� �D�I�I�-�T�3��
���&)�W�n�F�%������	�	�r(c��UR(aUR5 UR5 URS;a�[	U[
[45(a�[U5S;auURS:Xa[U5S:XaUSOSnUSSnURceURR[
U5U5nURS:XaUW4OUnURRX5$)a]
Modifies the pixel at the given position. The color is given as
a single numerical value for single-band images, and a tuple for
multi-band images. In addition to this, RGB and RGBA tuples are
accepted for P and PA images.

Note that this method is relatively slow.  For more extensive changes,
use :py:meth:`~PIL.Image.Image.paste` or the :py:mod:`~PIL.ImageDraw`
module instead.

See:

* :py:meth:`~PIL.Image.Image.paste`
* :py:meth:`~PIL.Image.Image.putdata`
* :py:mod:`~PIL.ImageDraw`

:param xy: The pixel coordinate, given as (x, y). See
   :ref:`coordinate-system`.
:param value: The pixel value.
r3)r>r?r�r?r>r�N)rrNrMr�r�rAr�r�rr�r6r�)r�r�r�r��
palette_indexs     r)r��Image.putpixel0s���0�=�=��J�J�L��	�	��
�I�I��$��5�4��-�0�0��E�
�f�$��y�y�D� �$'��J�!�O��a�����b�q�	���<�<�+�+�+� �L�L�1�1�%��,��E�M�.2�i�i�4�.?�]�E�*�]�E��w�w����*�*r(c��SSKJn URS;a
Sn[U5eSnSnUczURS:XaNUR	5 UR
R
5nUS:XaS	nUR
RXf5nO/[S
[S555nO[U5S:�aS	nSnSnS
/S-n[U5Hup�XrX�-X�-U--
nX�U
'M [U5nUR5nSUl
UR"XkU-S9UlUR
RXfS-URR!55 UR#S5nURXv5 UR"XgS9UlSUR$;a.UR'UR$S5UR$S'U$U$![a! SUR$;a
UR$S	U$f=f)a-
Rewrites the image to reorder the palette.

:param dest_map: A list of indexes into the original palette.
   e.g. ``[1,0]`` would swap a two item palette, and ``list(range(256))``
   is the identity transform.
:param source_palette: Bytes or None.
:returns:  An :py:class:`~PIL.Image.Image` object.

rr4)r�r�r�r>r�r�r�r?c3�*# �UH	oS-v� M g7f)r>Nr!�r�r�s  r)r��&Image.remap_palette.<locals>.<genexpr>ws���*F�:�a��6�:�s�ir(rr�r�z;Lr�r�)r�rur�rArMr6r�re�	bytearrayr�r�r�r5rrr�rfr�r�index)
r��dest_map�source_paletterur�r��palette_mode�
palette_bytes�
new_positionsr��oldPosition�mapping_palette�m_ims
             r)�
remap_palette�Image.remap_paletteZs���	#��9�9�J�&�&�C��S�/�!������!��y�y�C���	�	��#�w�w�5�5�7���6�)��E�!%���!3�!3�L�!O��!*�*F�5��:�*F�!F��
��
 �3�
&��E�!�L��
���c�	�
�(��1�N�A���#�k�&9�E�&A��
�M�*+�+�&�	2�0$�M�2���y�y�{����
�#�0�0��E�"9�
���	
�����<��)<�d�l�l�>R�>R�>T�U��|�|�C� �����
�4�#�0�0��U����T�Y�Y�&�
2�,4�N�N�4�9�9�^�;T�,U��	�	�.�)�
��t���	�
2�!�T�Y�Y�.��	�	�.�1����	
2�s�+G�'G9�8G9c
��[US-
nUSUS-
US-nUSUS-
US-nXE-nXF-n[S[USU-
55[S[USU-
55[URS[
R"USU-55[URS[
R"USU-554$)zpExpands the box so it includes adjacent pixels
that may be used by resampling with the given resampling filter.
rZr=rr>r)�_filters_supportr�r�r�r(�math�ceil)	r�r(�resampler�filter_support�scale_x�scale_y�	support_x�	support_ys	         r)�
_get_safe_box�Image._get_safe_box�s���*�(�3�c�9���q�6�C��F�?�d�1�g�-���q�6�C��F�?�d�1�g�-��"�,�	�"�,�	�
��3�s�1�v�	�)�*�+���3�s�1�v�	�)�*�+���	�	�!��d�i�i��A���(:�;�<���	�	�!��d�i�i��A���(:�;�<�	
�	
r(c�8�UcDURRS5nU(a[RO[RnGOU[R[R
[R[R[R[R4;a�SUS3n[RS4[RS4[R
S4[RS4[RS	4[RS
44Vs/sHnUSSUS
S3PM nnUSSRUSS5SUS3-
n[U5eUbUS:a
Sn[U5eUcSUR-n[U5nURU:Xa#USUR-:XaUR5$URS;a[RnURS;abU[R:waNURSSS.UR5n	U	RXU5n	U	RUR5$UR!5 UGbU[R:wa�[#USUS
-
US
-U-5=(d Sn
[#USUS-
US-U-5=(d SnU
S:�dUS:�a�UR%U['[U5U5nX�4n
[)UR*5(aUR+X�S9O[,R+X
US9nUS
US
-
U
-USUS-
U-USUS
-
U
-USUS-
U-4nUR/UR0RXU55$s snf)aX
Returns a resized copy of this image.

:param size: The requested size in pixels, as a tuple or array:
   (width, height).
:param resample: An optional resampling filter.  This can be
   one of :py:data:`Resampling.NEAREST`, :py:data:`Resampling.BOX`,
   :py:data:`Resampling.BILINEAR`, :py:data:`Resampling.HAMMING`,
   :py:data:`Resampling.BICUBIC` or :py:data:`Resampling.LANCZOS`.
   If the image has mode "1" or "P", it is always set to
   :py:data:`Resampling.NEAREST`. If the image mode is "BGR;15",
   "BGR;16" or "BGR;24", then the default filter is
   :py:data:`Resampling.NEAREST`. Otherwise, the default filter is
   :py:data:`Resampling.BICUBIC`. See: :ref:`concept-filters`.
:param box: An optional 4-tuple of floats providing
   the source image region to be scaled.
   The values must be within (0, 0, width, height) rectangle.
   If omitted or None, the entire source is used.
:param reducing_gap: Apply optimization by resizing the image
   in two steps. First, reducing the image by integer times
   using :py:meth:`~PIL.Image.Image.reduce`.
   Second, resizing using regular resampling. The last step
   changes size no less than by ``reducing_gap`` times.
   ``reducing_gap`` may be None (no first step is performed)
   or should be greater than 1.0. The bigger ``reducing_gap``,
   the closer the result to the fair resampling.
   The smaller ``reducing_gap``, the faster resizing.
   With ``reducing_gap`` greater or equal to 3.0, the result is
   indistinguishable from fair resampling in most cases.
   The default value is None (no optimization).
:returns: An :py:class:`~PIL.Image.Image` object.
NzBGR;�Unknown resampling filter (�).�Image.Resampling.NEAREST�Image.Resampling.LANCZOS�Image.Resampling.BILINEAR�Image.Resampling.BICUBIC�Image.Resampling.BOX�Image.Resampling.HAMMINGr� (r�)� Use �, ���� or r[z#reducing_gap must be 1.0 or greaterr�r�r�r�r�r�r=r>)r)r��
startswithrRrTrXrVrYrUrWr�rAr(r�r5r��resizerMr�r�rr�reducer�r7r6)r�r(r�r�reducing_gap�bgrr�r�filtersr6�factor_x�factor_y�
reduce_box�factors              r)r��Image.resize�sx��P���)�)�&�&�v�.�C�-0�z�)�)�j�6H�6H�H�
��������������N�N����

�
�0��z��<�C�
 �'�'�)C�D��'�'�)C�D��(�(�*E�F��'�'�)C�D��^�^�%;�<��'�'�)C�D�
�
��F��!�9�+�R��q�	�{�!�,��
�
�
�U�4�9�9�W�S�b�\�2�3�4����}�E�E�C��S�/�!��#��s�(:�7�C��S�/�!��;��4�9�9�$�C��T�{���9�9��������(:�!:��9�9�;���9�9�
�"�!�)�)�H��9�9��&�8�z�7I�7I�+I����T�6�:�4�9�9�E�F�B����4�3�/�B��:�:�d�i�i�(�(��	�	���#��J�4F�4F�(F��C��F�S��V�O�t�A�w�6��E�F�K�!�H��C��F�S��V�O�t�A�w�6��E�F�K�!�H��!�|�x�!�|�!�/�/��d�:�x�6P�RU�V�
�"�-�� ����,�,��K�K��K�7����d�
��C����V�j��m�+�x�7���V�j��m�+�x�7���V�j��m�+�x�7���V�j��m�+�x�7�	���y�y��������<�=�=��k
s�Nc���[U[[45(dX4nUcSUR-nUS:Xa#USUR-:XaUR	5$UR
S;aMUR
SSS.UR
5nURX5nUR
UR
5$UR5 URURRX55$)a�
Returns a copy of the image reduced ``factor`` times.
If the size of the image is not dividable by ``factor``,
the resulting size will be rounded up.

:param factor: A greater than 0 integer or tuple of two integers
   for width and height separately.
:param box: An optional 4-tuple of ints providing
   the source image region to be reduced.
   The values must be within ``(0, 0, width, height)`` rectangle.
   If omitted or ``None``, the entire source is used.
rr�r�r�r�)r�rAr�r(r5r�r�r�rMr7r6)r�rrr6s    r)r��Image.reduce6	s���"�&�4��-�0�0��%�F��;��4�9�9�$�C��V���v��	�	�'9� 9��9�9�;���9�9��&����T�6�:�4�9�9�E�F�B����6�'�B��:�:�d�i�i�(�(��	�	���y�y�������4�5�5r(Fc	��US-nU(d�U(d�US:XaUR5$US:XaUR[R5$US;aZU(dURUR
:Xa9URUS:Xa[R5$[R5$URupxUcSn	OUn	Uc
US-US-4n[R"U5*n[[R"U5S5[[R"U5S5S	[[R"U5*S5[[R"U5S5S	/n
SS
jnU"US*U	S-
US*U	S-
U
5uU
S'U
S'U
S==US-
ss'U
S==US-
ss'U(a�/n/n
SUS4Xx4SU44H3up�U"X�U
5unnURU5 U
RU5 M5 [R"[!U55[R""[%U55-
n[R"[!U
55[R""[%U
55-
nU"UU-
*S
-UU-
*S
-U
5uU
S'U
S'UUp�UR'Xx4[(R*X�US9$)a�
Returns a rotated copy of this image.  This method returns a
copy of this image, rotated the given number of degrees counter
clockwise around its centre.

:param angle: In degrees counter clockwise.
:param resample: An optional resampling filter.  This can be
   one of :py:data:`Resampling.NEAREST` (use nearest neighbour),
   :py:data:`Resampling.BILINEAR` (linear interpolation in a 2x2
   environment), or :py:data:`Resampling.BICUBIC` (cubic spline
   interpolation in a 4x4 environment). If omitted, or if the image has
   mode "1" or "P", it is set to :py:data:`Resampling.NEAREST`.
   See :ref:`concept-filters`.
:param expand: Optional expansion flag.  If true, expands the output
   image to make it large enough to hold the entire rotated image.
   If false or omitted, make the output image the same size as the
   input image.  Note that the expand flag assumes rotation around
   the center and no translation.
:param center: Optional center of rotation (a 2-tuple).  Origin is
   the upper left corner.  Default is the center of the image.
:param translate: An optional post-rotate translation (a 2-tuple).
:param fillcolor: An optional color for area outside the rotated image.
:returns: An :py:class:`~PIL.Image.Image` object.
g�v@r�)�Zirrr=��c�>�Uup4pVpxX0-XA--U-X`-Xq--U-4$r�r!)	rlr�r�rr}rr�r�r^s	         r)r��Image.rotate.<locals>.transform�	s3��!'��Q�1���5�1�5�=�1�$�a�e�a�e�m�a�&7�7�7r(rr@r\)�	fillcolor)rlrr�rr�zlist[float]r�tuple[float, float])r5�	transposer;rEr�r�rDrFr(r��radiansr�cos�sinr�r�r��floorr�r�rJrL)r��angler�r�center�	translater�wr,�
post_transr�r��xx�yyrlr��
transformed_x�
transformed_y�nw�nhs                    r)�rotate�Image.rotateY	s���D��
���)���z��y�y�{�"���|��~�~�i�&:�&:�;�;��	�!�v����t�{�{�1J��~�~�+0�B�;�I�'�'���<E�<P�<P���,�y�y������J�"�J��>��!�e�Q��U�^�F����e�$�$���$�(�(�5�/�2�&��$�(�(�5�/�2�&���4�8�8�E�?�"�B�'��$�(�(�5�/�2�&��

��	8� )�
�A�Y�J��A��&����
�Z��]�(B�F� 
���q�	�6�!�9�	�q�	�V�A�Y��	��q�	�V�A�Y��	���B��B��!�Q��!��!�Q��8���/8��v�/F�,�
�}��	�	�-�(��	�	�-�(�9����3�r�7�#�d�j�j��R��&9�9�B����3�r�7�#�d�j�j��R��&9�9�B�
$-�r�A�v�Y��_��Q��i�#�o�v�#V� �F�1�I�v�a�y��r�q��~�~�
�F�I�$�$�f�)��
�	
r(c�^�SnSn[U5(a[R"U5nSnO/U[R:Xa[RR
nU(dK[US5(a:[UR5(a [R"UR5nUR5 URSS5n0[US05EUEUlSUl
[5 [RR!U5SR#5n[%U[&5(aUR)5OUnU(dU[*;a
[-5 [*UnUR35[4;a
[-5 U(a[6UR35nO[4UR35nSnU(ak[RR9U5(+nUR;SS5(a[<R>"US5nO/[<R>"US
5nO[A[B[&U5nU"XU5 U?U(aURG5 g
g
![a GN.f=f![.an	S	U3n
[1U
5U	eS
n	A	ff=f![DaH U(aURG5 U(a([RH"U5 e![Ja ef=fef=f![a N�f=f!U?f![a ff=f=f)a�
Saves this image under the given filename.  If no format is
specified, the format to use is determined from the filename
extension, if possible.

Keyword options can be used to provide additional instructions
to the writer. If a writer doesn't recognise an option, it is
silently ignored. The available options are described in the
:doc:`image format documentation
<../handbook/image-file-formats>` for each writer.

You can use a file object instead of a filename. In this case,
you must always specify the format. The file object must
implement the ``seek``, ``tell``, and ``write``
methods, and be opened in binary mode.

:param fp: A filename (string), os.PathLike object or file object.
:param format: Optional format override.  If omitted, the
   format to use is determined from the filename extension.
   If a file object was used instead of a filename, this
   parameter should always be used.
:param params: Extra parameters to the image writer.
:returns: None
:exception ValueError: If the output format could not be determined
   from the file name.  Use the format option to solve this.
:exception OSError: If the file could not be written.  The file
   may have been created, and may contain partial data.
r�FTr��save_all�encoderinfor!rzunknown file extension: Nr�zr+bzw+b)&rrW�fspath�sys�stdout�bufferr�r7r�rQ�popr�r!�
encoderconfigr��path�splitext�lowerr�r�r�r�r�r�rA�upperr�r��existsrU�builtinsrxrr
rJr@�remove�PermissionError)
r�r?r�paramsr_�open_fpr �filename_ext�extr�r��save_handler�createds
             r)rZ�
Image.save�	s���@!#�����2�;�;��y�y��}�H��G�
�3�:�:�
�
��Z�Z�&�&���G�B��/�/�G�B�G�G�4D�4D��y�y����)�H�	
�����:�:�j�%�0��I�g�d�M�2�>�I�&�I���.0����	��w�w�'�'��1�!�4�:�:�<��'1�,��'F�'F�l�!�!�#�L����)�#���
-�"�3���
�<�<�>��%��F��#�F�L�L�N�3�L������/�L�����'�'�.�.��2�2�G��z�z�(�E�*�*��]�]�8�U�3���]�]�8�U�3���b��i��$�B�	���8�,�
��$���H�H�J���}"�
��
��.�
-�0���6�� ��o�1�,��
-��2�	�����
����I�I�h�'�
��'�������	��"�
��
��
��$��!�
��
�s��I>�+	J�	J2�#L�>
J�J�
J/�J*�*J/�2(L�K2�1L�2
K?�<L�>K?�?L�L�
L�L�L,�L�L,�
L)�&L,�(L)�)L,c�*�US:wa
Sn[U5eg)a�
Seeks to the given frame in this sequence file. If you seek
beyond the end of the sequence, the method raises an
``EOFError`` exception. When a sequence file is opened, the
library automatically seeks to frame 0.

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.
:exception EOFError: If the call attempts to seek beyond the end
    of the sequence.
rzno more images in fileN)�EOFError)r��framer�s   r)ru�
Image.seek6
s��$�A�:�*�C��3�-��r(c��[XS9 g)a�
Displays this image. This method is mainly intended for debugging purposes.

This method calls :py:func:`PIL.ImageShow.show` internally. You can use
:py:func:`PIL.ImageShow.register` to override its default behaviour.

The image is first saved to a temporary file. By default, it will be in
PNG format.

On Unix, the image is then opened using the **xdg-open**, **display**,
**gm**, **eog** or **xv** utility, depending on which one can be found.

On macOS, the image is opened with the native Preview application.

On Windows, the image is opened with the standard PNG display utility.

:param title: Optional title to use for the image window, where possible.
)�titleN)�_show)r�r<s  r)�show�
Image.showL
s��(	�d� r(c���UR5 URRS:XaUR54$[	[URURR555$)a�
Split this image into individual bands. This method returns a
tuple of individual image bands from an image. For example,
splitting an "RGB" image creates three new images each
containing a copy of one of the original bands (red, green,
blue).

If you need only one band, :py:meth:`~PIL.Image.Image.getchannel`
method can be more convenient and faster.

:returns: A tuple containing bands.
r)rMr6r�r5r�rIr7rWr�s r)rW�Image.splitb
sK��	
�	�	���7�7�=�=�A���I�I�K�>�!��S����D�G�G�M�M�O�4�5�5r(c�(�UR5 [U[5(a UR5R	U5nUR
URRU55$![
anSUS3n[U5UeSnAff=f)a
Returns an image containing a single channel of the source image.

:param channel: What channel to return. Could be index
  (0 for "R" channel of "RGB") or channel name
  ("A" for alpha channel of "RGBA").
:returns: An image in "L" mode.

.. versionadded:: 4.3.0
zThe image has no channel "�"N)	rMr�r�r"r�rAr7r6r)r��channelr�r�s    r)�
getchannel�Image.getchannelu
s��	
�	�	���g�s�#�#�
-��-�-�/�/�/��8��
�y�y�������1�2�2��	�
-�2�7�)�1�=�� ��o�1�,��
-�s�A0�0
B�:B�Bc��g)z�
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.
rr!r�s r)rt�
Image.tell�
s��r(r\c�^^
�[[[RU55m
SU
U4SjjnU"5nUcgUnSnUb:TR	S[USU-5[USU-545nUbUSnTRU:waCTRXbXsS9n	U	RTlUTl	TRRTlSTlg)aV
Make this image into a thumbnail.  This method modifies the
image to contain a thumbnail version of itself, no larger than
the given size.  This method calculates an appropriate thumbnail
size to preserve the aspect of the image, calls the
:py:meth:`~PIL.Image.Image.draft` method to configure the file reader
(where applicable), and finally resizes the image.

Note that this function modifies the :py:class:`~PIL.Image.Image`
object in place.  If you need to use the full resolution image as well,
apply this method to a :py:meth:`~PIL.Image.Image.copy` of the original
image.

:param size: The requested size in pixels, as a 2-tuple:
   (width, height).
:param resample: Optional resampling filter.  This can be one
   of :py:data:`Resampling.NEAREST`, :py:data:`Resampling.BOX`,
   :py:data:`Resampling.BILINEAR`, :py:data:`Resampling.HAMMING`,
   :py:data:`Resampling.BICUBIC` or :py:data:`Resampling.LANCZOS`.
   If omitted, it defaults to :py:data:`Resampling.BICUBIC`.
   (was :py:data:`Resampling.NEAREST` prior to version 2.5.0).
   See: :ref:`concept-filters`.
:param reducing_gap: Apply optimization by resizing the image
   in two steps. First, reducing the image by integer times
   using :py:meth:`~PIL.Image.Image.reduce` or
   :py:meth:`~PIL.Image.Image.draft` for JPEG images.
   Second, resizing using regular resampling. The last step
   changes size no less than by ``reducing_gap`` times.
   ``reducing_gap`` may be None (no first step is performed)
   or should be greater than 1.0. The bigger ``reducing_gap``,
   the closer the result to the fair resampling.
   The smaller ``reducing_gap``, the faster resizing.
   With ``reducing_gap`` greater or equal to 3.0, the result is
   indistinguishable from fair resampling in most cases.
   The default value is 2.0 (very close to fair resampling
   while still being faster in many cases).
:returns: None
c��>^^^�SSjnTummTTR:�aTTR:�agTRTR-mTT-T:�aU"TT-UU4SjS9mTT4$U"TT-UU4SjS9mTT4$)Nc�|�[[[R"U5[R"U5US9S5$)N��keyr)r�r�r�rr�)�numberrMs  r)�round_aspect�DImage.thumbnail.<locals>.preserve_aspect_ratio.<locals>.round_aspect�
s+���3�t�z�z�&�1�4�9�9�V�3D�#�N�PQ�R�Rr(c�&>�[TUT--
5$r��r)�n�aspectr�s ��r)�<lambda>�@Image.thumbnail.<locals>.preserve_aspect_ratio.<locals>.<lambda>�
s���3�v��A��~�;Nr(rLc�6>�US:XaS$[TTU--
5$r&rR)rSrTrls ��r)rUrV�
s!���1��6�a�.R�s�6�A�PQ�E�>�?R�.Rr()rNrrM�Callable[[int], float]rr�)r�r�)rOrTrlr��
provided_sizer�s @@@��r)�preserve_aspect_ratio�.Image.thumbnail.<locals>.preserve_aspect_ratio�
s����
S�!�D�A�q��D�J�J��1����#3���Z�Z�$�+�+�-�F��1�u��� ��V��1N�O��
�a�4�K�!���J�$R����a�4�Kr(Nrr)rr�)r�tuple[int, int] | None)
r�rIr�rrr�r(r�r6rr�rr)r�r(r�r�rZ�preserved_size�
final_sizer�resr6rYs`         @r)�	thumbnail�Image.thumbnail�
s����Z�c�$�*�*�d�3�4�
�	�	�"/�0���!��#�
����#��*�*��s�4��7�\�1�2�C��Q��,�8N�4O�P��C����!�f���9�9�
�"����Z�s��V�B��e�e�D�G�#�D�J������D�J���
r(rc
�:�URS;a_U[R:waKURSSS.UR5R	XX4XV5RUR5$[U[5(aUR	XXES9$[US5(aUR5up#Uc
Sn[U5e[URX5nURS:Xa0UR(aURR5UlURR5Ul
U[R:Xa1UH)up�UR!X�[R"X�USL5 M+ U$UR!S	U-XX4USL5 U$)
a"
Transforms this image.  This method creates a new image with the
given size, and the same mode as the original, and copies data
to the new image using the given transform.

:param size: The output size in pixels, as a 2-tuple:
   (width, height).
:param method: The transformation method.  This is one of
  :py:data:`Transform.EXTENT` (cut out a rectangular subregion),
  :py:data:`Transform.AFFINE` (affine transform),
  :py:data:`Transform.PERSPECTIVE` (perspective transform),
  :py:data:`Transform.QUAD` (map a quadrilateral to a rectangle), or
  :py:data:`Transform.MESH` (map a number of source quadrilaterals
  in one operation).

  It may also be an :py:class:`~PIL.Image.ImageTransformHandler`
  object::

    class Example(Image.ImageTransformHandler):
        def transform(self, size, data, resample, fill=1):
            # Return result

  Implementations of :py:class:`~PIL.Image.ImageTransformHandler`
  for some of the :py:class:`Transform` methods are provided
  in :py:mod:`~PIL.ImageTransform`.

  It may also be an object with a ``method.getdata`` method
  that returns a tuple supplying new ``method`` and ``data`` values::

    class Example:
        def getdata(self):
            method = Image.Transform.EXTENT
            data = (0, 0, 100, 100)
            return method, data
:param data: Extra data to the transformation method.
:param resample: Optional resampling filter.  It can be one of
   :py:data:`Resampling.NEAREST` (use nearest neighbour),
   :py:data:`Resampling.BILINEAR` (linear interpolation in a 2x2
   environment), or :py:data:`Resampling.BICUBIC` (cubic spline
   interpolation in a 4x4 environment). If omitted, or if the image
   has mode "1" or "P", it is set to :py:data:`Resampling.NEAREST`.
   See: :ref:`concept-filters`.
:param fill: If ``method`` is an
  :py:class:`~PIL.Image.ImageTransformHandler` object, this is one of
  the arguments passed to it. Otherwise, it is unused.
:param fillcolor: Optional fill color for the area outside the
   transform in the output image.
:returns: An :py:class:`~PIL.Image.Image` object.
r�r�r�)r��fillrNzmissing method datar�r)r�rRrTr�r�r��ImageTransformHandlerr7rrAr6rr5rrJrP�_Image__transformerrO)r�r(r�r�r�rcrr�r6r�quads           r)r��Image.transform�
s^��v�9�9��&�8�z�7I�7I�+I����D�&�9�$�)�)�D�E���4���I������#�
��f�3�4�4��#�#�D��#�M�M��6�9�%�%�!�>�>�+�L�F��<�'�C��S�/�!�
����D�
,���9�9���������*�*�,�B�J��)�)�.�.�"����Y�^�^�#�!�	��� � ��y�~�~�t�y�D�?P��"��	�	
�����
�t�T�Y�$�=N�
��	r(c
��USUS-
nUSUS-
nU[R:XaUSSnO�U[R:Xa+Uup�p�X�-
U-n
X�-
U-n[RnU
SU	SX�4nO�U[R:XaUSSnO�U[R:Xa�USSnUSSnUSSnUSSnUup�SU-nSU-nU	USU	-
U-USU	-
U-USUS-
US-
U	-U-U-U
USU
-
U-USU
-
U-USUS-
US-
U
-U-U-4nO
S	n[U5eU[R[R[R4;a�U[R[R[R4;a?[RS
[RS[RS0nUUS
US3-nOSUS3n[RS4[RS4[RS44Vs/sHnUSS
USS3PM nnUSSRUSS5SUS3-
n[U5eUR5 UR5 URS;a[RnUR R#XR X4XV5 gs snf)Nr=rr>rrA�r?r[zunknown transformation methodr�r�r�r�z) cannot be used.r�r�r�r�r�r�r�r�r�r�r�)rJrLrMrNrOrArRrTrVrXrUrWrYr�rMr�r6r�)r�r�imager�r�r�rcrr,rrr	r
�xs�ysr�sw�se�ne�As�Atr��unusablerr�s                         r)�
__transformer�Image.__transformerLs#��
��F�S��V�O����F�S��V�O���Y�%�%�%����8�D�
�y�'�'�
'�!�N�B�B��'�Q��B��'�Q��B��%�%�F���2�q�"�)�D�
�y�,�,�
,����8�D�
�y�~�~�
%��b�q��B��a���B��a���B��a���B��F�B��q��B��q��B���A����r�!��A����r�!��A���A����A��&��+�r�1�B�6���A����r�!��A����r�!��A���A����A��&��+�r�1�B�6�	�D�2�C��S�/�!�����������
�
�
�J�N�N�J�,>�,>�
�@R�@R�S�S��N�N�$:��&�&�(B��&�&�(B�,��
�x�(�R��z�9J�+K�K��3�H�:�R�@��
 �'�'�)C�D��(�(�*E�F��'�'�)C�D����F��!�9�+�R��q�	�{�!�,��
��
�U�4�9�9�W�S�b�\�2�3�4����}�E�E�C��S�/�!�
�
�
���	�	���:�:��#�!�)�)�H������#�x�x��x�F��%s�J;c�v�UR5 URURRU55$)a~
Transpose image (flip or rotate in 90 degree steps)

:param method: One of :py:data:`Transpose.FLIP_LEFT_RIGHT`,
  :py:data:`Transpose.FLIP_TOP_BOTTOM`, :py:data:`Transpose.ROTATE_90`,
  :py:data:`Transpose.ROTATE_180`, :py:data:`Transpose.ROTATE_270`,
  :py:data:`Transpose.TRANSPOSE` or :py:data:`Transpose.TRANSVERSE`.
:returns: Returns a flipped or rotated copy of this image.
)rMr7r6r
)r�r�s  r)r
�Image.transpose�s+��	
�	�	���y�y����*�*�6�2�3�3r(c�v�UR5 URURRU55$)zR
Randomly spread pixels in an image.

:param distance: Distance to spread pixels.
)rMr7r6�
effect_spread)r��distances  r)rx�Image.effect_spread�s+��	
�	�	���y�y����.�.�x�8�9�9r(c�n�SSKJn UR(d
Sn[U5eUR"U5$)z#Returns a QImage copy of this imager�rv�Qt bindings are not installed)r�rv�qt_is_installedr��toqimage�r�rvr�s   r)r�Image.toqimage�s/����&�&�1�C��c�"�"�����%�%r(c�n�SSKJn UR(d
Sn[U5eUR"U5$)z$Returns a QPixmap copy of this imagerr|r})r�rvr~r��	toqpixmapr�s   r)r��Image.toqpixmap�s/����&�&�1�C��c�"�"�� � ��&�&r()
rr=rrrr'r!r?r6rrIrr�rr)r�core.ImagingCore)r6r�rr�rr�)r�tuple[int, int]�rr�)r6r�rr�)NN)r[rrrr\rrr�)r��objectrr.)rsrrrtr.rr)r{r�r|rr�bytes | None)rr�)rz.dict[str, str | bytes | int | tuple[int, ...]])r�	list[Any])r�r�rr�r�)r�r�r�rrr�)rj)r�r�rr�)r��*bytes | bytearray | SupportsArrayInterfacer�r�r�rrr)rzcore.PixelAccess | None)r�rr�ztuple[float, ...] | Noner�z
Dither | Nonerrer�r�rr�)r�r�r�r0r�r�r�Image | Noner�r^rr��rr�r�)r�(tuple[float, float, float, float] | Nonerr�)r6r�r�!tuple[float, float, float, float]rr�)r�rr(r\rz0tuple[str, tuple[int, int, float, float]] | None)rr�rr0rr�)rz-ImageFilter.Filter | type[ImageFilter.Filter]rr�)r�tuple[str, ...])r$r.r� tuple[int, int, int, int] | None)r�)r+r�rzBlist[tuple[int, tuple[int, ...]]] | list[tuple[int, float]] | None)r0r0rr�)rz1tuple[float, float] | tuple[tuple[int, int], ...]�rzdict[str, Any])rrS)rzlist[ImageFile.ImageFile])rrx)r�)r�rrzlist[int] | None�rr.)r��tuple[int, int] | list[int]rzfloat | tuple[int, ...] | None)rztuple[list[int], list[int]])r�r�r��tuple[float, float] | Noner�	list[int])r�r�r�r�rr)r6z'Image | str | float | tuple[float, ...]rz:Image | tuple[int, int, int, int] | tuple[int, int] | Noner�r�rr)rr)r6r�r��
Sequence[int]r�r�rr)r�z�Sequence[float] | NumpyArray | Callable[[int], float] | Callable[[ImagePointTransform], ImagePointTransform | float] | ImagePointHandlerr�rrr�)r�zImage | intrr)r[r)r�zISequence[float] | Sequence[Sequence[int]] | core.ImagingCore | NumpyArrayr�rr�rrr)r�z1ImagePalette.ImagePalette | bytes | Sequence[int]r�r�rr)r�r�r�z#float | tuple[int, ...] | list[int]rr)r�r�r�zbytes | bytearray | Nonerr�)r(r�r�rRrr�r�tuple[int, int, int, int])NNN)
r(z(tuple[int, int] | list[int] | NumpyArrayr�r0rr�r��float | Nonerr�)rzint | tuple[int, int]rr�rr�)rrr�rRrz
int | boolrr�rr\r�&float | tuple[float, ...] | str | Nonerr�)r?�StrOrBytesPath | IO[bytes]rrr0rrr)r9r�rr)r<rrr)rztuple[Image, ...])rDz	int | strrr�)r(rr�rRr�r�rr)r(r�r�z3Transform | ImageTransformHandler | SupportsGetDatar�zSequence[Any] | Noner�r�rcr�rr�rr�)rr�rjr�r�rJr�zSequence[float]r�r�rcr.rr)r�r;rr�)ryr�rr�)rzImageQt.ImageQt)r�ImageQt.QPixmap)br#r$r%r&rr�__annotations__r�!_close_exclusive_fp_after_loadingr��propertyr6�setterr�r�r(r�r7r:rBrFr@rNrQr`rgrorur~r�r�r�r�r�rfr�r�rMr�rergr�r^rcr�r5�__copy__rr�rrrr"r&r*rr4rNrdrgr�r�rer�r�r�r�r)r�r�r�r�r�r�r�r�r�r�r�r�rRrTrrZrur>rWrErtrXr`r�rer
rxrr�r'r!r(r)r�r�s���	��F�J��%)��
�)�(,�%�	'������Y�Y��������������������
� ���J�6�
�=A����/9��MP��	��0

�
�
��9�(��
��
�M�	�3 �j
�:"�#"�8�#"��#"��	#"�

�#"�J"�H	
� �+/� $�"�;�;��
{��{�)�{��	{�
�{��
{�
�{�~�!�� $��.�.�
Q��Q��Q��	Q�
�Q��
Q�
�Q�f	)��H�3�4)�"�)�)J�)�	�)�,
��
�&<�
�	9�
�2;�%�62�-1�+�( #�,��,�	K�,�2�.
$�%5�N!�F�,�\�7�,����*&�0
+�-�
+�	'�
+�
 �PT�#� �#�2L�#�	�#�DPT�!� �!�2L�!�	�!�>KO�!�	Y'�3�Y'�H�Y'��	Y'�

�Y'�xPV�6 ��6 �,�6 �?L�6 �	
�6 �B �:7�
 �:7��:7�
�:7�x5(�t��	-�W�-��-��	-�

�-�4�)�?�)��)�
�	)�V(+�!�(+�*M�(+�	
�(+�VOS�X�!�X�3K�X�	�X�t
��
��
�/�	
�

#�
�2 $�8<�%)�j>�6�j>��j>�6�	j>�
#�j>�
�
j>�^15�!6�%�!6�.�!6�
�	!6�L *�1�1�"�-1�,0�<@�r
��r
��r
��	r
�
+�r
�*�
r
�:�r
�
�r
�jDH�g�,�g�6@�g�SV�g�	
�g�R �,!�,6�&3�,	� *�1�1�%(�	T�!�T��T�#�	T�

�T�x&*�"�*�*��<@�\��\�D�\�#�	\�
�\��
\�:�\�
�\�H#�*�*��TG�
&�TG��TG��	TG�
�TG��
TG��TG�
�TG�l4�:�&�'r(c�@�\rSrSrSr\RSSj5rSrg)r�i�zV
Used as a mixin by point transforms
(for use with :py:meth:`~PIL.Image.Image.point`)
c��gr�r!r$s  r)r��ImagePointHandler.point�s��r(r!N)r6r�rr�)	r#r$r%r&r�abc�abstractmethodr�r'r!r(r)r�r��s!���
	���
��
r(r�c�P�\rSrSrSr\RSSj5rSrg)rdi�z]
Used as a mixin by geometry transforms
(for use with :py:meth:`~PIL.Image.Image.transform`)
c��gr�r!)r�r(rjr\s    r)r��ImageTransformHandler.transform�s��	
r(r!N)r(r�rjr�r\rrr�)	r#r$r%r&rr�r�r�r'r!r(r)rdrd�sG���
	���
��
��
��	
�

�
��
r(rdc�\�[5R[R"S55$)z+Create grayscale wedge (for debugging only)r�)r�r7r��wedger!r(r)�_wedger��s���7�<�<��
�
�3��(�(r(c���[U[[45(d
Sn[U5e[	U5S:wa
Sn[U5eUSS:d	USS:a
Sn[U5eg)z�
Common check to enforce type and sanity check on size tuples

:param size: Should be a 2 tuple of (width, height)
:returns: None, or raises a ValueError
zSize must be a list or tupler=z#Size must be a sequence of length 2rrzWidth and height must be >= 0N)r�rAr�rAr�)r(r�s  r)�_check_sizer��sg���d�T�5�M�*�*�,����o��
�4�y�A�~�3����o���A�w��{�d�1�g��k�-����o��"r(c��US;a[US5 [U5 Uc-[5R[R
"X55$[
U[5(aSSKJ	n URX 5n[5nUS:Xa�[
U[[45(a�[SU55(aw[[[S4[U55n[!U5S:Xd[!U5S	:Xa7SS
KJn UR""5UlUR$RU5nUR[R&"XU55$)ap
Creates a new image with the given mode and size.

:param mode: The mode to use for the new image. See:
   :ref:`concept-modes`.
:param size: A 2-tuple, containing (width, height) in pixels.
:param color: What color to use for the image.  Default is black.
   If given, this should be a single integer or floating point value
   for single-band modes, and a tuple for multi-band modes (one value
   per band).  When creating RGB or HSV images, you can also use color
   strings as supported by the ImageColor module.  If the color is
   None, the image is not initialised.
:returns: An :py:class:`~PIL.Image.Image` object.
r�r5rr�r�c3�B# �UHn[U[5v� M g7fr�)r�r�r�s  r)r��new.<locals>.<genexpr>3s���2�E�q�
�1�c�"�"�E�s�.r>r?r4)rr�r�r7r�r6r�r�r�r�r�rAr��allrr�r�rurrc)r�r(�colorr�r6�
color_intsrus       r)r6r6s��(�-�-��$�������}��w�|�|�D�H�H�T�0�1�1��%����	!��#�#�E�0��	��B�����u�t�U�m�,�,��2�E�2�2�2�&*�5��c��?�E�%�L�&I�
��z�?�a��3�z�?�a�#7�&�%�2�2�4�B�J��J�J�'�'�
�3�E�
�7�7�4�9�9�T��/�0�0r(c��[U5 [X5nURS:wa^URS:waNUn[	U5S:Xa[US[5(aUSnUS:XaUS:XaUnURX#U5 U$)a?
Creates a copy of an image memory from pixel data in a buffer.

In its simplest form, this function takes three arguments
(mode, size, and unpacked pixel data).

You can also use any pixel decoder supported by PIL. For more
information on available decoders, see the section
:ref:`Writing Your Own File Codec <file-codecs>`.

Note that this function decodes pixel data only, not entire images.
If you have an entire image in a string, wrap it in a
:py:class:`~io.BytesIO` object, and use :py:func:`~PIL.Image.open` to load
it.

:param mode: The image mode. See: :ref:`concept-modes`.
:param size: The image size.
:param data: A byte buffer containing raw data for the given mode.
:param decoder_name: What decoder to use.
:param args: Additional parameters for the given decoder.
:returns: An :py:class:`~PIL.Image.Image` object.
rrr�r!)r�r6r�r�r�r�r�r�)r�r(r�r�r�r6r�s       r)r�r�?s|��<���	�T��B�	�x�x�1�}����a�� ���|���!�j��a��%�&H�&H�'��?�L��5� �\�R�%7��L�
���T��6�
�Ir(c	��[U5 [U5S:Xa[US[5(aUSnUS:Xa�US:XaUSS4nUS[;az[US5nUR
[R"X!USU55nUS:Xa7SSK	J
n UR"SURRS55Ul
SUlU$[XX#U5$)	aq
Creates an image memory referencing pixel data in a byte buffer.

This function is similar to :py:func:`~PIL.Image.frombytes`, but uses data
in the byte buffer, where possible.  This means that changes to the
original buffer object are reflected in this image).  Not all modes can
share memory; supported modes include "L", "RGBX", "RGBA", and "CMYK".

Note that this function decodes pixel data only, not entire images.
If you have an entire image file in a string, wrap it in a
:py:class:`~io.BytesIO` object, and use :py:func:`~PIL.Image.open` to load it.

The default parameters used for the "raw" decoder differs from that used for
:py:func:`~PIL.Image.frombytes`. This is a bug, and will probably be fixed in a
future release. The current release issues a warning if you do this; to disable
the warning, you should provide the full set of parameters. See below for details.

:param mode: The image mode. See: :ref:`concept-modes`.
:param size: The image size.
:param data: A bytes or other buffer object containing raw
    data for the given mode.
:param decoder_name: What decoder to use.
:param args: Additional parameters for the given decoder.  For the
    default encoder ("raw"), it's recommended that you provide the
    full set of parameters::

        frombuffer(mode, size, data, "raw", mode, 0, 1)

:returns: An :py:class:`~PIL.Image.Image` object.

.. versionadded:: 1.1.4
rrr�r!rr�r4r�)r�r�r�r��	_MAPMODESr6r7r��
map_bufferr�rur6rerrr�)r�r(r�r�r�r6rus       r)�
frombufferr�ms���P����4�y�A�~�*�T�!�W�e�4�4��A�w���u���2�:���A�:�D���7�i���T�6�"�B��������\�1�d�K�L�B��s�{�*�)�6�6�u�b�e�e�>N�>N�u�>U�V��
��B�K��I��T��T�:�:r(c�,�\rSrSrSr\SSj5rSrg)�SupportsArrayInterfacei�z;
An object that has an ``__array_interface__`` dictionary.
c��[5er�)�NotImplementedErrorr�s r)r��*SupportsArrayInterface.__array_interface__�s��!�#�#r(r!Nr�)r#r$r%r&rr�r�r'r!r(r)r�r��s����$��$r(r�c	�x�URnUSn[U5nURSS5nUcSUSS-US4n[
UupOUn	US
;aSnOUS:XaSnOS
nXL:�aSUSUS3n[
U5eUS:XaSOUSUS4n
UbQ[US5(aUR5nO/[US5(aUR5nO
Sn[
U5e[XUSU	SS5$![anSn[	U5UeSnAff=f![anUup�SU
S	U3n[	U5UeSnAff=f)a�
Creates an image memory from an object exporting the array interface
(using the buffer protocol)::

  from PIL import Image
  import numpy as np
  a = np.zeros((5, 5))
  im = Image.fromarray(a)

If ``obj`` is not contiguous, then the ``tobytes`` method is called
and :py:func:`~PIL.Image.frombuffer` is used.

In the case of NumPy, be aware that Pillow modes do not always correspond
to NumPy dtypes. Pillow modes only offer 1-bit pixels, 8-bit pixels,
32-bit signed integer pixels, and 32-bit floating point pixels.

Pillow images can also be converted to arrays::

  from PIL import Image
  import numpy as np
  im = Image.open("hopper.jpg")
  a = np.asarray(im)

When converting Pillow images to arrays however, only pixel values are
transferred. This means that P and PA mode images will lose their palette.

:param obj: Object with array interface
:param mode: Optional mode to use when reading ``obj``. Will be determined from
  type if ``None``.

  This will not be used to convert the data after reading, but will be used to
  change how the data is read::

    from PIL import Image
    import numpy as np
    a = np.full((1, 1), 300)
    im = Image.fromarray(a, mode="L")
    im.getpixel((0, 0))  # 44
    im = Image.fromarray(a, mode="RGB")
    im.getpixel((0, 0))  # (44, 1, 0)

  See: :ref:`concept-modes` for general information about modes.
:returns: An image object.

.. versionadded:: 1.1.6
r��stridesNr�r=r�zCannot handle this data typezCannot handle this data type: r�)r�r�r�r�r�r�r>r?zToo many dimensions: z > r�rrrf�tostringz1'strides' requires either tobytes() or tostring()r�)r�r�rUr�r�_fromarray_typemaprAr7rfr�r�)�objr�r�r��ndimr��typekeyr�r�r��
typekey_shaper��ndmaxr(s              r)�	fromarrayr��s��^�
!�
!�C���L�E��u�:�D��g�g�i��&�G��|�	(��u�Q�R�y�(�#�i�.�8�G�	(�.�w�7�M�D�'����(�(���	
��������|�%�d�V�3�u�g�Q�7����o����	�1�u�Q�x��q��1�D����3�	�"�"��+�+�-�C�
�S�*�
%�
%��,�,�.�C�E�C��S�/�!��d�#�u�g�q�!�<�<��?�	(�0�C��C�.�a�'��	(��
�	(�%,�"�M�2�=�/��G�9�M�C��C�.�a�'��	(�s/�
C2�D�2
D�<D
�
D�
D9�D4�4D9c�n�SSKJn UR(d
Sn[U5eUR"U5$)z-Creates an image instance from a QImage imagerr|r})r�rvr~r��
fromqimage�r6rvr�s   r)r�r�

s/����"�"�-���#������b�!�!r(c�n�SSKJn UR(d
Sn[U5eUR"U5$)z.Creates an image instance from a QPixmap imagerr|r})r�rvr~r��fromqpixmapr�s   r)r�r�
s/����"�"�-���#������r�"�"r()r�z|b1)r�z1;8)r��|u1)r�r�)r�z|i1)r�zI;8)r�z<u2)r�r�)r�z>u2)r�r�)r�z<i2)r�zI;16S)r�z>i2)r�zI;16BS)r�z<u4)r�zI;32)r�z>u4)r�zI;32B)r�z<i4)r�zI;32S)r�z>i4)r�zI;32BS)r�z<f4)r�zF;32F)r�z>f4)r�zF;32BF)r�z<f8)r�zF;64F)r�z>f8)r�zF;64BF))rrr=r�)r�r�))rrr>r�)r�r�))rrr?r�)r�r�r��i4)r�r��f4)r�r�c��[cg[SUS5[SUS5-nUS[-:�aSUSS[-S3n[U5eU[:�a'[R"SUS[S3[
5 gg)Nrrr=zImage size (z pixels) exceeds limit of z0 pixels, could be decompression bomb DOS attack.)r1r�r,r�r�r)r(�pixelsr�s   r)rr<
s������
��D��G�_�s�1�d�1�g��
.�F�
��$�$�$��6�(�"<�Q�AQ�=Q�<R�S>�
>�	�%�S�)�)�
� � ��
�
��6�(�"<�=M�<N�O6�
6�$�	
�!r(c	�B^	^
^�US:waS[U53n[U5e[U[R5(a
Sn[U5eUc[
nO([U[[45(d
Sn[U5eSm
Sn[U5(a[R"U5nU(a[R"US5nSm
O[[[ U5nUR#S	5 UR+S
5n[-5 /mSU
U4SjjnU"XXR5nUcJU[
LaA[
R/5m	[15(aU"UUU[U	4SjU555nU(a	T
UlU$T
(aUR55 THn[6R8"U5 M S
U(aUOU-n[;U5e![$[R&4a* [R("UR+55nSm
GN(f=f)a9
Opens and identifies the given image file.

This is a lazy operation; this function identifies the file, but
the file remains open and the actual image data is not read from
the file until you try to process the data (or call the
:py:meth:`~PIL.Image.Image.load` method).  See
:py:func:`~PIL.Image.new`. See :ref:`file-handling`.

:param fp: A filename (string), os.PathLike object or a file object.
   The file object must implement ``file.read``,
   ``file.seek``, and ``file.tell`` methods,
   and be opened in binary mode. The file object will also seek to zero
   before reading.
:param mode: The mode.  If given, this argument must be "r".
:param formats: A list or tuple of formats to attempt to load the file in.
   This can be used to restrict the set of formats checked.
   Pass ``None`` to try all supported formats. You can print the set of
   available formats by running ``python3 -m PIL`` or using
   the :py:func:`PIL.features.pilinfo` function.
:returns: An :py:class:`~PIL.Image.Image` object.
:exception FileNotFoundError: If the file cannot be found.
:exception PIL.UnidentifiedImageError: If the image cannot be opened and
   identified.
:exception ValueError: If the ``mode`` is not "r", or if a ``StringIO``
   instance is used for ``fp``.
:exception TypeError: If ``formats`` is not ``None``, a list or a tuple.
�rz	bad mode zKStringIO cannot be used to open an image. Binary data must be used instead.zformats must be a list or tupleFr��rbTr�c�r>�UH�nUR5nU[;a
[5 [UupVU(+=(d U"U5n[U[5(aTRU5 MqU(a2UR
S5 U"X5n[UR5 Us $M� g![[[[R4a>n	[(a'TRUS-[	U	5-5 Sn	A	GMSn	A	GMSn	A	f[a T
(aUR!5 ef=f)Nrz opening failed. )r+r~r�r�r�r�rurr(�SyntaxError�
IndexErrorr�struct�errorr/�
BaseExceptionr@)r?r_�prefix�formatsr��factory�acceptr�r6r��exclusive_fp�warning_messagess          ��r)�
_open_core�open.<locals>._open_core�
s�����A����	�A���}���
�"&�q�'���#��5�v�f�~���f�c�*�*�$�+�+�F�3���G�G�A�J� ��.�B�-�b�g�g�6��I�	��*�� ��Y����E�
N�(�(�$�+�+�A�0C�,C�c�!�f�,L�M�M�)�� �
���H�H�J��
�s�AB3�56B3�3$D6�+D�&D6c3�6># �UHoT;dM
Uv� M g7fr�r!)r�r�checked_formatss  �r)r��open.<locals>.<genexpr>�
s����T�7��O�6S�f�f�7�s�	�	zcannot identify image file %r)
r?�	IO[bytes]r_zstr | bytesr�r�r�zlist[str] | tuple[str, ...]rzImageFile.ImageFile | None)�reprrAr�rx�StringIOr}rAr�rrrWr"r-rxrr
r�rur��UnsupportedOperationryrvr�r5r�rEr@r�r�r)r?r�r�r�r_r�r�r6�messager�r�r�s         @@@r)rxrxQ
s����D�s�{��$�t�*��&����o��	�B����	$�	$�
0�	���o������
��$���
/�
/�/����n���L��H��r�{�{��9�9�R�=���
�]�]�8�T�
*����
�"�U�)�R�
 ���
����
�
�W�W�R�[�F��I�"$���������-�	�

$���:
�B�&�	2�B�	�z�g��m��'�'�)���6�6������T�7�T�T�	�B�
�'����	��
���
�#���
�
�g��$�
)��X�r�
J�C�
 ��
%�%��y
�B�3�3�4��
�Z�Z����	�
"�����s�$G�AH�Hc��UR5 UR5 UR[R"URUR55$)z�
Alpha composite im2 over im1.

:param im1: The first image. Must have mode RGBA.
:param im2: The second image.  Must have mode RGBA, and the same size as
   the first image.
:returns: An :py:class:`~PIL.Image.Image` object.
)rMr7r�r�r6)�im1�im2s  r)r�r��
s:���H�H�J��H�H�J��8�8�D�(�(�������8�9�9r(c��UR5 UR5 UR[R"URURU55$)aW
Creates a new image by interpolating between two input images, using
a constant alpha::

    out = image1 * (1.0 - alpha) + image2 * alpha

:param im1: The first image.
:param im2: The second image.  Must have the same mode and size as
   the first image.
:param alpha: The interpolation alpha factor.  If alpha is 0.0, a
   copy of the first image is returned. If alpha is 1.0, a copy of
   the second image is returned. There are no restrictions on the
   alpha value. If necessary, the result is clipped to fit into
   the allowed output range.
:returns: An :py:class:`~PIL.Image.Image` object.
)rMr7r��blendr6)r�r�r�s   r)r�r��
s:��$�H�H�J��H�H�J��8�8�D�J�J�s�v�v�s�v�v�u�5�6�6r(c�L�UR5nURUSU5 U$)aF
Create composite image by blending images using a transparency mask.

:param image1: The first image.
:param image2: The second image.  Must have the same mode and
   size as the first image.
:param mask: A mask image.  This image can have mode
   "1", "L", or "RGBA", and must have the same size as the
   other two images.
N)r5r�)�image1�image2r�rjs    r)�	compositer��
s$��
�K�K�M�E�	�K�K���d�#��Lr(c�*�URUS5$)a�
Applies the function (which should take one argument) to each pixel
in the given image. If the image has more than one band, the same
function is applied to each band. Note that the function is
evaluated once for each possible pixel value, so you cannot use
random components or other generators.

:param image: The input image.
:param function: A function object, taking one integer argument.
:returns: An :py:class:`~PIL.Image.Image` object.
r)r�)rjr�s  r)�evalr�
s���;�;�t�A�w��r(c	���[U5[U5:wdSU;a
Sn[U5eUSSHSnUR[	U5:wa
Sn[U5eUR
USR
:wdMHSn[U5e UHnUR
5 M USR[R"U/UVs/sHoDRPM snQ765$s snf)aM
Merge a set of single band images into a new multiband image.

:param mode: The mode to use for the output image. See:
    :ref:`concept-modes`.
:param bands: A sequence containing one single-band image for
    each band in the output image.  All bands must have the
    same size.
:returns: An :py:class:`~PIL.Image.Image` object.
�*zwrong number of bandsrNz
mode mismatchrz
size mismatch)r�r�rAr�r�r(rMr7r�rr6)r�r�r�r0r}s     r)rrs����D��S��Z�'�3�$�;�%����o���a�b�	���9�9��D�)�)�!�C��S�/�!��9�9��a��
�
�%�!�C��S�/�!�
����	�	�����8�=�=����D�A�%�+@�%�Q�D�D�%�+@�A�B�B��+@s�C$c�v�UR5nU[;a[RU5 X4[U'g)a
Register an image file plugin.  This function should not be used
in application code.

:param id: An image format identifier.
:param factory: An image file factory method.
:param accept: An optional function that can be used to quickly
   reject images having another format.
N)r+r}r�r~)rnr�r�s   r)�
register_openr�9s,��"
����B�	��|�
�	�	�"�
���D��Hr(c�2�U[UR5'g)a�
Registers an image MIME type by populating ``Image.MIME``. This function
should not be used in application code.

``Image.MIME`` provides a mapping from image format identifiers to mime
formats, but :py:meth:`~PIL.ImageFile.ImageFile.get_format_mimetype` can
provide a different result for specific images.

:param id: An image format identifier.
:param mimetype: The image MIME type for this format.
N)r�r+)rn�mimetypes  r)�
register_mimerPs�� �D�����r(c�2�U[UR5'g)z�
Registers an image save function.  This function should not be
used in application code.

:param id: An image format identifier.
:param driver: A function to save images in this format.
N)r�r+�rn�drivers  r)�
register_saver_s���D�����r(c�2�U[UR5'g)z�
Registers an image function to save all the frames
of a multiframe format.  This function should not be
used in application code.

:param id: An image format identifier.
:param driver: A function to save images in this format.
N)r�r+rs  r)�register_save_allrls��"�H�R�X�X�Z�r(c�N�UR5[UR5'g)z�
Registers an image extension.  This function should not be
used in application code.

:param id: An image format identifier.
:param extension: An extension used for this format.
N)r+r�r*)rn�	extensions  r)�register_extensionr
zs��$&�8�8�:�I�i�o�o�� r(c�,�UHn[X5 M g)z�
Registers image extensions.  This function should not be
used in application code.

:param id: An image format identifier.
:param extensions: A list of extensions used for this format.
N)r
)rn�
extensionsr	s   r)�register_extensionsr
�s�� �	��2�)� r(c�"�[5 [$)zU
Returns a dictionary containing all file extensions belonging
to registered plugins
)r�r�r!r(r)�registered_extensionsr�s��
	�F��r(c��U[U'g)z�
Registers an image decoder.  This function should not be
used in application code.

:param name: The name of the decoder
:param decoder: An ImageFile.PyDecoder object

.. versionadded:: 4.1.0
N)r�)r�r�s  r)�register_decoderr��
���H�T�Nr(c��U[U'g)z�
Registers an image encoder.  This function should not be
used in application code.

:param name: The name of the encoder
:param encoder: An ImageFile.PyEncoder object

.. versionadded:: 4.1.0
N)r�)r�r�s  r)�register_encoderr�rr(c�6�SSKJn UR"U40UD6 g)Nr)�	ImageShow)r�rr>)rjr\rs   r)r=r=�s���
�N�N�5�$�G�$r(c�^�[5R[R"XU55$)z�
Generate a Mandelbrot set covering the given extent.

:param size: The requested size in pixels, as a 2-tuple:
   (width, height).
:param extent: The extent to cover, as a 4-tuple:
   (x0, y0, x1, y1).
:param quality: Quality.
)r�r7r��effect_mandelbrot)r(�extent�qualitys   r)rr�s"���7�<�<��.�.�t�W�E�F�Fr(c�\�[5R[R"X55$)z�
Generate Gaussian noise centered around 128.

:param size: The requested size in pixels, as a 2-tuple:
   (width, height).
:param sigma: Standard deviation of noise.
)r�r7r��effect_noise)r(�sigmas  r)rr�s ���7�<�<��)�)�$�6�7�7r(c�\�[5R[R"U55$)z`
Generate 256x256 linear gradient from black to white, top to bottom.

:param mode: Input mode.
)r�r7r��linear_gradientr�s r)rr�� ���7�<�<��,�,�T�2�3�3r(c�\�[5R[R"U55$)za
Generate 256x256 radial gradient from black to white, centre to edge.

:param mode: Input mode.
)r�r7r��radial_gradientr�s r)r"r"�r r(c�2�UbUO[RnS[R4S[R4S[R
44Hlup#X!;aMXR
5nSnSH.upgURU5(dMUnUS[U5*nM0 [U5U-nU"U5 Mn g![a [R"US35 M�f=f![a&n	[R"USU	35 Sn	A	M�Sn	A	ff=f)N�PILLOW_ALIGNMENT�PILLOW_BLOCK_SIZE�PILLOW_BLOCKS_MAXr))rCi)r�iz is not intz: )
rW�environr��
set_alignment�set_block_size�set_blocks_maxr*rXr�r�rAr�r�)
�env�env_dict�var_namer��var�units�postfix�mul�var_intr�s
          r)�_apply_env_variablesr3�s���o�s�2�:�:�H�
�T�/�/�0�	�d�1�1�2�	�d�1�1�2����
�#��� �&�&�(����=�L�G��|�|�G�$�$����/�S��\�M�*��>�
	��#�h��&�G�
	.��7�O�/��$�	��M�M�X�J�k�2�3��	���	.��M�M�X�J�b���,�-�-��	.�s*� B<�/C&�<#C#�"C#�&
D�0D�Dc��\rSrSr%SrSrS\S'SrSrSSjr	SSjr
SS	jrSSS
jjrSSjr
S SjrSS!S
jjrS"SjrS#S$SjjrS%SjrSSjrS&SjrS'SjrS(SjrS)SjrS*SjrS+SjrS,SjrSrg)-rSia�
This class provides read and write access to EXIF image data::

  from PIL import Image
  im = Image.open("exif.png")
  exif = im.getexif()  # Returns an instance of this class

Information can be read and written, iterated over or deleted::

  print(exif[274])  # 1
  exif[274] = 2
  for k, v in exif.items():
    print("Tag", k, "Value", v)  # Tag 274 Value 2
  del exif[274]

To access information beyond IFD0, :py:meth:`~PIL.Image.Exif.get_ifd`
returns a dictionary::

  from PIL import ExifTags
  im = Image.open("exif_gps.jpg")
  exif = im.getexif()
  gps_ifd = exif.get_ifd(ExifTags.IFD.GPSInfo)
  print(gps_ifd)

Other IFDs include ``ExifTags.IFD.Exif``, ``ExifTags.IFD.MakerNote``,
``ExifTags.IFD.Interop`` and ``ExifTags.IFD.IFD1``.

:py:mod:`~PIL.ExifTags` also has enum classes to provide names for data::

  print(exif[ExifTags.Base.Software])  # PIL
  print(gps_ifd[ExifTags.GPS.GPSDateStamp])  # 1999:99:99 99:99:99
Nrr[Fc�J�0Ul0Ul0UlSUlSUlgr�)�_data�_hidden_data�_ifdsrr�_loaded_exifr�s r)r��
Exif.__init__As'��%'��
�,.���02��
�CG��
�*.��r(c�|�[U5S:Xa[U[5(aUS$U$![a U$f=fr	)r�r�r�rJ)r�r�s  r)�_fixup�Exif._fixupHsG��	��5�z�Q��:�e�U�#;�#;��Q�x������	����	�s�(-�
;�;c�v�UR5VVs0sHup#X RU5_M snn$s snnfr�)r@r<)r��src_dictrCr�s    r)�_fixup_dict�Exif._fixup_dictPs2��/7�n�n�.>�?�.>�d�a��;�;�q�>�!�.>�?�?��?s�5c��URRU5 SSKJn UR"UR
US9nUR
UR5 UR[U55$![[4a gf=f)Nrrk)�group)r?rur�rw�ImageFileDirectory_v2�headrMr@�dictr�r)r�r�rCrwrs     r)rm�Exif._get_ifd_dictUsr��	0�
�G�G�L�L�� �
*�"�8�8����%�P�D��I�I�d�g�g���#�#�D��J�/�/���)�$�	��	�s�A3�3B�Bc��UR(aSOSnURS:XaSU-S-[S5-nOSU-[S5-nUR(a-X RS:Xa[S5O
[S5-
nUS-
nU$)	N�+�*r�sIIrJrisMMs)rYr[rr)r�r�rEs   r)�	_get_head�Exif._get_headesy��!�\�\�'�w���;�;�#���7�?�W�,�u�Q�x�7�D��w�&��q��1�D��<�<����s� 2�E�!�H��a��@�D��'�'�D��r(c��XR:XagXlURR5 URR5 URR5 U(a:URS5(a$USSnU(aURS5(aM$U(dSUlg[R"U5Ul	URRS5UlSSKJ
n UR"UR5UlURRUlURR#URR$5 URR'UR5 g)N�ExifrArirrk)r9r6�clearr7r8r�rrrxryr?rvrEr�rwrDrZr[rursrM)r�r�rws   r)rM�	Exif.loadps���$�$�$�� ���
�
���������!��
�
�����t����7�7����8�D��t����7�7���D�J���Z�Z��-����G�G�L�L��O��	�%�$�:�:�4�9�9�E��
��j�j�(�(��������T�Z�Z�_�_�%��
�
������ r(c��SUlURR5 URR5 URR5 SSKJn XlUbUR5Ul	O URRS5Ul	UR"UR5UlURcURRUl
UcURRnURR!5 URR#U5 URR%UR5 g)Nrrkri)r9r6rOr7r8r�rwr?rKrErvrDrrr[rZrsrtrurM)r�r?r�rws    r)r\�Exif.load_from_fp�s��� ����
�
���������!��
�
����	&��������(�D�I������Q��D�I�$�:�:�4�9�9�E��
��;�;���*�*�,�,�D�K��>��Z�Z�_�_�F������������V���
�
������ r(c��[U5n[RRU;a]UR	U[RR[RR5nU(aURU5 [RRU;a`UR	U[RR[RR5U[RR'U$r�)rFrrorSrm�update�GPSInfo)r��merged_dictr�s   r)�_get_merged_dict�Exif._get_merged_dict�s����4�j���<�<����$��$�$�T�(�,�,�*;�*;�%<�h�l�l�>O�>O�P�C���"�"�3�'��<�<���4�'�04�0B�0B��X�\�\�)�)�*�H�L�L�,@�,@�1�K����,�,�-��r(c�R�SSKJn UR5nUR"US9nURR5HupVXP;dMXdU'M UR5GH(upWU[RR[RR4;a�[U[5(d�URU5nU[RR:Xa�[RRU;a�[U[RR[5(dTUR5nUR[RR5U[RR'XtU'GM+ SU-URU5-$)Nrrk)�ifhrN)r�rwrKrDr8r@rrorSrUr�rFrn�Interopr5rf)r�r�rwrEr�r;�ifd_dictr�s        r)rf�Exif.tobytes�s2��%��~�~����3�3��=��!�Z�Z�-�-�/�M�C���#�C��0��*�*�,�J�C�����!�!����$�$���!���-�-����S�)���8�<�<�,�,�,� ���,�,��5�&�u�X�\�\�-A�-A�'B�D�I�I�!�J�J�L�E�26�,�,�x�|�|�?S�?S�2T�E�(�,�,�.�.�/���H�'���%����F�(;�;�;r(c	��XR;Ga9U[RR:Xa_URbPURR
S:wa6UR
URR
5nUbX RU'GO�U[RR[RR4;aQURRXRU55nUb"UR
X15nUbX RU'GO3U[RR[RR4;Ga�[RRUR;a)UR[RR5 UR[RRUnU[RR:XGa>SSKJn USSS:XGa0[!US5nXFSn0n[#S[$R&"SUSS5S5H�n	[$R&"SXyS	-S-U	S-S	-S-5up�p�UR(UunnX�-nUS
:�a'[$R&"SU
5unXsS	-
UU-S	-
n
OU
SUn
[-U
5U:wa*[.R0"SUS
[-U
5SU
35 M�U
(dM�U"U"5U
S5X�'M� [3UR5U55URU'GO URS5S:XGa�0n[#S[$R&"SUSS5S5GH�n	[$R&"SXIS	-S-U	S-S	-S-5up�p�U
S:XdM7[$R&"SU
5unUR6R9U5 SUR6R;S
50nUR6R;S
5 [!UR6R;S	55US'UR6R;S
5 UR6R;S
5US'UR6R;S	5 UR6R;S
5nUR([<R>SnU"U"5US5SUS'UR6R;S
5 UR6R;S5US'SU0nGM� X�RU'O"UR
XA5nUbX RU'URRAU05nU[RR:XaqUR(a`URC5VVs0sHCunnU[RR[RR4;dM@UU_ME nnnU$![*a GM�f=fs snnf)Nrr)rDrisFUJIFILMz<Hr=z<HHL4sr5r?z<Lz9Possibly corrupt EXIF MakerNote data.  Expecting to read z bytes but only got z. Skipping tag Fi�Nintendoz>Hz>HHL4siz>L�ModelID�	TimeStamp�InternalSerialNumber�Parallax�Category)"r8rrorprrrsrmrSrUr7rUr[�	MakerNoternrwrDrr�r��unpack�_load_dispatchr�r�r�r�rFr@r?rurvr�FLOAT�
setdefaultr@)r�r;r�r��tag_datarDr��ifd_data�	makernoter��ifd_tag�typ�countr��	unit_size�handlerr(�
camerainfo�parallaxrCr�s                     r)rn�Exif.get_ifd�s���j�j� ��h�l�l�'�'�'��:�:�)�d�j�j�o�o��.B��,�,�T�Z�Z�_�_�=�C���*-�
�
�3�������*�*�H�L�L�,@�,@�A�A��*�*�.�.�s�H�H�S�M�B���%��,�,�V�9�C���*-�
�
�3�������-�-�x�|�|�/E�/E�F�F��<�<�$�$�D�J�J�6��L�L����!2�!2�3��:�:�h�l�l�&7�&7�8��=���(�,�,�0�0�0�F����|�{�2�%*�8�Q�%7�
�#+�K�#8��$&�	�!&�q�&�-�-��h�r��l�*K�A�*N�!O�A�8>�
�
� (�(�r�6�A�:��Q��"��q�@P�*Q�9�5�G�%�)�%:�$H�$H��$M�!"�$-�$+�$)�#4�D�#�a�x�,2�M�M�$��,E�	��'/���f�t�m�b�>P�'Q��'+�E�T�{��"�4�y�D�0� (�
�
�%9�9=��>R�'*�4�y�k���	�%K�!"�
!)�#'� (�18� 5� 7��u�2�I�.�;"P�@+/�t�/?�/?�	�/J�*K��
�
�3�����&�)�Z�7�$&�	�!&�q�&�-�-��h�r��l�*K�A�*N�!O�A�8>�
�
� (�(�r�6�A�:��Q��"��q�@P�*Q�9�5�G�%� '�&�0�,2�M�M�$��,E�	�� $�����V� 4�%.�t�w�w�|�|�A��F"�
�!%�����Q��:?������R�@P�:Q�
�;� 7� $�����Q��EI�W�W�\�\�RS�_�
�+A� B� $�����R� 0�+/�7�7�<�<��?��*?�*N�*N�$,�N�N�+"�"#�+%��:A�$9�$;�X�u�:"�"#�:%�
�:� 6�!%�����Q��9=�����a��
�:� 6�-3�Z�,@�	�A"P�B+4�
�
�3����,�,�X�;�C���*-�
�
�3���j�j�#�#�C��,���(�,�,�#�#�#��(9�(9�"�i�i�k��)�F�Q���X�\�\�1�1�8�<�<�3I�3I�J�J���1��)�
��
�
��Q$,�)� (�)��Fs�"W7�(?X	�+X	�7
X�Xc��[RR[RR4HnX;dM
XURU'X	M gr�)rrorSrUr7�r�r;s  r)�hide_offsets�Exif.hide_offsets9sA���L�L�%�%�x�|�|�';�';�<�C��{�)-���!�!�#�&��I�=r(c�t�URbURHnX M	 [UR5$r�)rrr�r6rvs  r)�__str__�Exif.__str__?s/���:�:�!��z�z���	�"��4�:�:��r(c��[UR5nURbURUR5 [	U5$r�)�setr6rrrTr��r��keyss  r)�__len__�Exif.__len__Gs3���4�:�:����:�:�!��K�K��
�
�#��4�y�r(c���URbVXR;aGXR;a8URURU5URU'URU	URU$r�)rrr6r<rvs  r)�__getitem__�Exif.__getitem__MsU���:�:�!�c���&;��z�z�@Q�"�k�k�$�*�*�S�/�:�D�J�J�s�O��
�
�3���z�z�#��r(c�r�XR;=(d# URSL=(a XR;$r�)r6rrrvs  r)�__contains__�Exif.__contains__Ss)���j�j� �R�T�Z�Z�t�%;�%Q��z�z�@Q�Rr(c�r�URbXR;a
URU	X RU'gr��rrr6)r�r;r�s   r)�__setitem__�Exif.__setitem__Vs+���:�:�!�c�Z�Z�&7��
�
�3���
�
�3�r(c�r�URbXR;aURU	gURU	gr�r�rvs  r)�__delitem__�Exif.__delitem__[s+���:�:�!�c�Z�Z�&7��
�
�3���
�
�3�r(c��[UR5nURbURUR5 [	U5$r�)r}r6rrrT�iterr~s  r)�__iter__�
Exif.__iter__as3���4�:�:����:�:�!��K�K��
�
�#��D�z�r()r6r7r8rrr9r[r?rEr�)r�rrr)r?�dict[int, Any]rr�r�)r�r�rCr0rzdict[int, Any] | None)rr�)r�r�rr)r?r�r�r0rr)rr�)ri)r�r�rr�)r;r�rr�r�r�)r;r�rr)r;r�rr.)r;r�r�rrr)r;r�rr)rz
Iterator[int])r#r$r%r&rr[r�rYrTr�r<r@rmrKrMr\rWrfrnrwrzr�r�r�r�r�r�r'r!r(r)rSrSs����B�F�J���G��G�/��@�04�0��0�",�0�	�0� 	�!�:!�.�"<�0j�X����S� �
 �r(rS)r8rrzTypeGuard[Image])r6r�rztuple[tuple[int, ...], str])r�r�rr�)r�r�rr�)r�r�rr�r�r�)r!)
r�r�r�r�r�rr��tuple[Any, ...]rz)core.ImagingDecoder | ImageFile.PyDecoder)
r�r�r�r�r�rr�r�rz)core.ImagingEncoder | ImageFile.PyEncoder)r
z<Callable[[ImagePointTransform], ImagePointTransform | float]rrr�)r(rrr)r)r�r�r(r�r�r�rr�r�)r�r�r(r�r�r�r�r�r�rrr�)r�r�r(r�r�zbytes | SupportsArrayInterfacer�r�r�rrr�r�)r�r�r�rrr�)r6zImageQt.QImager�ImageFile.ImageFile)r6r�rr�)r(r�rr)r�N)r?r�r�zLiteral['r']r�z"list[str] | tuple[str, ...] | Nonerr�)r�r�r�r�rr�)r�r�r�r�r�rrr�)r�r�r�r�r�r�rr�)rjr�r�rXrr�)r�r�r�zSequence[Image]rr�)rnr�r�zSCallable[[IO[bytes], str | bytes], ImageFile.ImageFile] | type[ImageFile.ImageFile]r�z$Callable[[bytes], bool | str] | Nonerr)rnr�rr�rr)rnr�rz/Callable[[Image, IO[bytes], str | bytes], None]rr)rnr�r	r�rr)rnr�rr|rr)rr)r�r�r�ztype[ImageFile.PyDecoder]rr)r�r�r�ztype[ImageFile.PyEncoder]rr)rjr�r\rrr)r(r�rr�rr�rr�)r(r�rrrr�)r�r�rr�)r+zdict[str, str] | Nonerr)��
__future__rr��atexitr-rx�loggingr�rWr9r�r#rUr��collections.abcrrrr�enumr�typesr	�typingr
rrr
rrr�rrrrrr�_binaryrrr�
_deprecater�_utilrrr��
defusedxmlrr��	getLoggerr#r��RuntimeWarningrrJr,r/r�r1r2r�r�r�r�r6r�r�r�r9r;rJrRrUrVrWrXrYr�r^rerj�modules�module�item�setattrr�r�r7rp�FILTERED�HUFFMAN_ONLY�RLE�FIXED�mmap�xml.etree.ElementTreerq�IPython.lib.prettyrrrsrtrurvrw�_typingrxryrzr{r}r~r�r�r�r�r�r��	byteorder�_ENDIANr��MODESr�r�r�r�r�r�r�r�r�r�r�rrr�r�rdr�r�r�r�r�r�r�r�r�rrxr�r�r�r�rr�rrrr
r
rrrr=rrrr"r3�register�clear_cache�	_ExifBaserSr!r(r)�<module>r�s���6#�
�
��	���	�	�
�
���H�H�������)�(�!�)�
���&�
�	�	�8�	$��	�~�	�	�Y�	�$��t�#� #�#?�@��*�@�
�#��g�d�$4�d�;�;�
�$�T�+;�T�B�C�D�*�m�
-�	�
�#���
<�4�(���
��
�����N�N�C��������������������W���g��
�w��

���X�	��
�	�:�v�w��I�D������	�	�4�:�:�.��
J�
�4�#�$�$��,�,���}�}�H��$�$�L�
�(�(�C��J�J�E���-�0�P�P�K�K���I���
�����n��CE��@�E�GI��
D�I��	�>��13��
.�3�13��
.�3�
���(�*�#����	��2
I�	�
,�	,�)�.���*�Z�@GI�(�

�(� �(�(+�(�4C�(�.�(�4GI�(�

�(� �(�(+�(�4C�(�.�(�:'L�'L�TQ�
F�Q��Q�.�h�.�t&'�t&'�vM
�
�

�

�.)��,56�11�

�11�
%�11�2�11��	11�p�	+�

�+�
�+�5�+��	+�
�+��
+�d�	;;�

�;;�
�;;�)�;;��	;;�
�;;��
;;�|$�X�$�U=�p"�#���\���Z�	�
�\���]�
��^���^���_���]���^���^���_���^���_�� �^�!�"�_�#�$��%�&��'�(�(���y��^��j���y��^��j�/��6
�.�26�{&�"�{&�
�{&�0�{&��	{&�D:�7�.�"
 � C�J48�
���	$��
1�
�
��. �
��
�D�
�	�
�"��"�D�"�	�"�.�	*��
�
�"%�G�
�G�#D�G�OR�G�
�G�8�4�4�.�>������ � �!���s�C�x�(�I��I�J�9�J��iv���K���H�
����[�)R�S�T�D�
�1�v���/�0�0�	�
�
�M��	
�
�	

�Q��	�	�3�	4�	4��
�
�c�!�f�n�-�
��
�s+�R�,R$�R!� R!�$T-�*A>T(�(T-

Filemanager

Name Type Size Permission Actions
BdfFontFile.cpython-313.pyc File 4.28 KB 0644
BlpImagePlugin.cpython-313.pyc File 23.93 KB 0644
BmpImagePlugin.cpython-313.pyc File 17.97 KB 0644
BufrStubImagePlugin.cpython-313.pyc File 2.68 KB 0644
ContainerIO.cpython-313.pyc File 6.72 KB 0644
CurImagePlugin.cpython-313.pyc File 2.37 KB 0644
DcxImagePlugin.cpython-313.pyc File 2.73 KB 0644
DdsImagePlugin.cpython-313.pyc File 22.58 KB 0644
EpsImagePlugin.cpython-313.pyc File 15.76 KB 0644
ExifTags.cpython-313.pyc File 11.43 KB 0644
FitsImagePlugin.cpython-313.pyc File 6.06 KB 0644
FliImagePlugin.cpython-313.pyc File 6.76 KB 0644
FontFile.cpython-313.pyc File 4.45 KB 0644
FpxImagePlugin.cpython-313.pyc File 7.66 KB 0644
FtexImagePlugin.cpython-313.pyc File 5.25 KB 0644
GbrImagePlugin.cpython-313.pyc File 3.68 KB 0644
GdImageFile.cpython-313.pyc File 3.35 KB 0644
GifImagePlugin.cpython-313.pyc File 44.88 KB 0644
GimpGradientFile.cpython-313.pyc File 5.35 KB 0644
GimpPaletteFile.cpython-313.pyc File 2.12 KB 0644
GribStubImagePlugin.cpython-313.pyc File 2.68 KB 0644
Hdf5StubImagePlugin.cpython-313.pyc File 2.65 KB 0644
IcnsImagePlugin.cpython-313.pyc File 17 KB 0644
IcoImagePlugin.cpython-313.pyc File 14.92 KB 0644
ImImagePlugin.cpython-313.pyc File 12.76 KB 0644
Image.cpython-313.pyc File 165.73 KB 0644
ImageChops.cpython-313.pyc File 10.63 KB 0644
ImageCms.cpython-313.pyc File 42.28 KB 0644
ImageColor.cpython-313.pyc File 12.22 KB 0644
ImageDraw.cpython-313.pyc File 43.5 KB 0644
ImageDraw2.cpython-313.pyc File 9.43 KB 0644
ImageEnhance.cpython-313.pyc File 5.28 KB 0644
ImageFile.cpython-313.pyc File 30.8 KB 0644
ImageFilter.cpython-313.pyc File 22.79 KB 0644
ImageFont.cpython-313.pyc File 65.84 KB 0644
ImageGrab.cpython-313.pyc File 6.56 KB 0644
ImageMath.cpython-313.pyc File 15.95 KB 0644
ImageMode.cpython-313.pyc File 2.75 KB 0644
ImageMorph.cpython-313.pyc File 11.03 KB 0644
ImageOps.cpython-313.pyc File 28.21 KB 0644
ImagePalette.cpython-313.pyc File 12.04 KB 0644
ImagePath.cpython-313.pyc File 306 B 0644
ImageQt.cpython-313.pyc File 8.46 KB 0644
ImageSequence.cpython-313.pyc File 3.33 KB 0644
ImageShow.cpython-313.pyc File 13.72 KB 0644
ImageStat.cpython-313.pyc File 7.13 KB 0644
ImageTransform.cpython-313.pyc File 5.19 KB 0644
ImageWin.cpython-313.pyc File 11.44 KB 0644
ImtImagePlugin.cpython-313.pyc File 2.55 KB 0644
IptcImagePlugin.cpython-313.pyc File 8.91 KB 0644
Jpeg2KImagePlugin.cpython-313.pyc File 18.34 KB 0644
JpegImagePlugin.cpython-313.pyc File 33.72 KB 0644
JpegPresets.cpython-313.pyc File 7.9 KB 0644
McIdasImagePlugin.cpython-313.pyc File 2.23 KB 0644
MicImagePlugin.cpython-313.pyc File 3.85 KB 0644
MpegImagePlugin.cpython-313.pyc File 3.68 KB 0644
MpoImagePlugin.cpython-313.pyc File 8.04 KB 0644
MspImagePlugin.cpython-313.pyc File 5.87 KB 0644
PSDraw.cpython-313.pyc File 7.67 KB 0644
PaletteFile.cpython-313.pyc File 1.9 KB 0644
PalmImagePlugin.cpython-313.pyc File 9.46 KB 0644
PcdImagePlugin.cpython-313.pyc File 2.05 KB 0644
PcfFontFile.cpython-313.pyc File 9.68 KB 0644
PcxImagePlugin.cpython-313.pyc File 7.27 KB 0644
PdfImagePlugin.cpython-313.pyc File 9.64 KB 0644
PdfParser.cpython-313.pyc File 52.78 KB 0644
PixarImagePlugin.cpython-313.pyc File 1.94 KB 0644
PngImagePlugin.cpython-313.pyc File 61.98 KB 0644
PpmImagePlugin.cpython-313.pyc File 14.13 KB 0644
PsdImagePlugin.cpython-313.pyc File 10.81 KB 0644
QoiImagePlugin.cpython-313.pyc File 6.02 KB 0644
SgiImagePlugin.cpython-313.pyc File 8.37 KB 0644
SpiderImagePlugin.cpython-313.pyc File 12.27 KB 0644
SunImagePlugin.cpython-313.pyc File 3.42 KB 0644
TarIO.cpython-313.pyc File 1.86 KB 0644
TgaImagePlugin.cpython-313.pyc File 8.11 KB 0644
TiffImagePlugin.cpython-313.pyc File 99.07 KB 0644
TiffTags.cpython-313.pyc File 18.43 KB 0644
WalImageFile.cpython-313.pyc File 4.01 KB 0644
WebPImagePlugin.cpython-313.pyc File 13.27 KB 0644
WmfImagePlugin.cpython-313.pyc File 6.19 KB 0644
XVThumbImagePlugin.cpython-313.pyc File 2.61 KB 0644
XbmImagePlugin.cpython-313.pyc File 4.05 KB 0644
XpmImagePlugin.cpython-313.pyc File 4.2 KB 0644
__init__.cpython-313.pyc File 1.98 KB 0644
__main__.cpython-313.pyc File 346 B 0644
_binary.cpython-313.pyc File 3.24 KB 0644
_deprecate.cpython-313.pyc File 2.37 KB 0644
_tkinter_finder.cpython-313.pyc File 745 B 0644
_typing.cpython-313.pyc File 2.14 KB 0644
_util.cpython-313.pyc File 1.5 KB 0644
_version.cpython-313.pyc File 222 B 0644
features.cpython-313.pyc File 13.58 KB 0644
report.cpython-313.pyc File 278 B 0644
Filemanager