%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/lib/python3/dist-packages/PIL/__pycache__/
Upload File :
Create Path :
Current File : //usr/lib/python3/dist-packages/PIL/__pycache__/TiffImagePlugin.cpython-312.pyc

�

��e�+�#��ddlmZddlZddlZddlZddlZddlZddlZddlZddl	m
Z
ddlmZddl
mZmZddlmZmZmZmZmZmZddlmZdd	lmZdd
lmZddlmZej<e�Z dZ!dZ"d
Z#dZ$dZ%dZ&dZ'dZ(dZ)dZ*dZ+dZ,dZ-dZ.dZ/dZ0dZ1dZ2dZ3dZ4dZ5d Z6d!Z7d"Z8d#Z9d$Z:d%Z;d&Z<d'Z=d(Z>d)Z?d*Z@d+ZAd,ZBd-ZCd.ZDd/ZEd0ZFd1ZGd2ZHd3ZId4ZJd5ZKd6ZLd7ZMd8ZNidd9�d:d;�d<d=�d>d?�d@dA�dBdC�dDdE�dFdG�dHdI�dJdK�dLdM�dNdO�dPdQ�dRdS�dTdU�dVdW�dXdY�ZOeOj��D��cic]\}}||��
c}}ZQie%ddZddZd[fd\�e&ddZddZd[fd\�e%ddZd:dZd[fd]�e&ddZd:dZd[fd]�e%ddZddZd[fd^�e&ddZddZd[fd^�e%ddZd:dZd[fd_�e&ddZd:dZd[fd_�e%ddZdd`d[fda�e&ddZdd`d[fda�e%ddZd:d`d[fdb�e&ddZd:d`d[fdb�e%ddZdd`d[fdc�e&ddZdd`d[fdc�e%ddZd:d`d[fdd�e&ddZd:d`d[fdd�e%ddZdded[fdf�ie&ddZdded[fdf�e%ddZd:ded[fdg�e&ddZd:ded[fdg�e%ddZdded[fdh�e&ddZdded[fdh�e%ddZd:ded[fdi�e&ddZd:ded[fdi�e%ddZddjd[fdk�e&ddZddjd[fdk�e%ddZd:djd[fdl�e&ddZd:djd[fdl�e%ddZddjd[fdm�e&ddZddjd[fdm�e%dd`ddjd[fdm�e&dd`ddjd[fdm�e%ddZd:djd[fdn�e&ddZd:djd[fdn��ie%ddZddod[fdp�e%ddZddqd[fdr�e%ddZddqd[fdr�e&ddZddqd[fds�e%ddZd:dqd[fdt�e%dd`ddqd[fdu�e&dd`ddqd[fdv�e%ddwddxd[fdy�e&ddwddxd[fdz�e%ddZddxd[fd{�e%dd`ddxd[fd|�e&dd`ddxd[fd}�e%ddwddxd[fdy�e&ddwddxd[fdz�e%ddZdd~d`fd�e&ddZdd~d`fd�e%d:dZdd�d[fd���ie&d:dZdd�d[fd��e%d:dZd:d�d[fd��e&d:dZd:d�d[fd��e%d:dZdd�d[fd��e&d:dZdd�d[fd��e%d:dZdd�d�fd��e&d:dZdd�d�fd��e%d:dZdd�d�fd��e&d:dZdd�d�fd��e%d:dZdd�d�fd��e&d:dZdd�d�fd��e%d:dZdd�dZfd��e&d:dZdd�dZfd��e%d:dZdd�d�fd��e&d:dZdd�d�fd��e%d:dZdd�d�fd��e&d:dZdd�d�fd���ie%d:dZdd�d`fd��e&d:dZdd�d`fd��e%d:dZdd�d�fd��e&d:dZdd�d�fd��e%d:dZdd�d�fd��e&d:dZdd�d�fd��e%d:dZdd�d�fd��e&d:dZdd�d�fd��e%d:dZdd�d[fd��e&d:dZdd�d[fd��e%d:dZdd�d[fd��e&d:dZdd�d[fd��e%d:dZdd�d�fd��e&d:dZdd�d�fd��e%d:dZdd�dZfd��e&d:dZdd�dZfd��e%d:dZdd�d`fd���ie&d:dZdd�d`fd��e%d<dZddZd[fd��e&d<dZddZd[fd��e%d<dZd:dZd[fd��e&d<dZd:dZd[fd��e%d<dZdd`d[fd��e&d<dZdd`d[fd��e%d<dZd:d`d[fd��e&d<dZd:d`d[fd��e%d<dZdded[fd��e&d<dZdded[fd��e%d<dZd:ded[fd��e&d<dZd:ded[fd��e%d<dZddjd[fd��e&d<dZddjd[fd��e%d<dZdd~d`fd��e&d<dZdd~d`fd���e%d<dZd:djd[fd�e&d<dZd:djd[fd�e%d@dZdd�d[fd�e&d@dZdd�d[fd�e%d@dZdd�d�fd�e&d@dZdd�d�fd�e%d@dZdd�d�fd�e&d@dZdd�d�fd�e%d@dZdd�d[fd�e%dBdZddjd[fdme&dBdZddjd[fdme%dBdZdd�d[fd�e&dBdZdd�d[fd�e%dFdZdd�d[fd�e&dFdZdd�d[fd�i�ZReSd��eRD��ZTgd��ZUd��ZVd��ZWd��ZXiZYiZZGd��d�e�Z[Gd��d�e
�Z\eYe\_YeZe\_Zej��D]:\Z]Z^e^j�d�d��Z^e`e\d�e^zeYe]d�e`e\d�e^zeZe]��<[Y[Z[][^Gd��d�e\�ZaeaZbGd��d�ej&�Zcid�d�e%dddZdf�d�d�e%dddjdf�d�d�e%ddd~d:f�d�d�e%d<ddjdf�d�d�e%d<dd~d:f�d�d�e%dd:dxdf�d�d�e%dddqdf�d�d�e%dd:dqdf�d�d�e%dd<dxdf�d�d�e%d:dd�df�d�d�e%d:dd�df�d�d�e%d:dd�d:f�d�d�e%d@dd�df�d�d�e%dBdd�df�d�d�e%dFdd�df�d�d�e&dd:dxdf�d�d�e&dddqdf�d�e&dd:dqdfd�e&dd<dxdfd֜�ZddׄZeGd؄d٫ZfdڄZgej�ecj�eceV�ej�ecj�ee�ej�ecj�eg�ej�ecj�d�d�g�ej�ecj�dݫycc}}w)��)�annotationsN)�MutableMapping)�Fraction)�Number�Rational�)�ExifTags�Image�	ImageFile�ImageOps�ImagePalette�TiffTags)�i16be)�i32be)�o8��TYPESFT�sIIsMM�iiiii
i�iiiiiii(i-i1i2i;i=i@iBiC�DiEiJiRiSi[iii��i��iI�is�ii�i�ii��i���raw��
tiff_ccitt��group3��group4��tiff_lzw��	tiff_jpeg��jpeg��tiff_adobe_deflatei��tiff_raw_16i��packbitsi)��tiff_thunderscani���tiff_deflateit��tiff_sgilogiu��
tiff_sgilog24im��lzmaiP��zstdiQ��webp�r�)�1z1;I)r2z1;IR)r2r2)r2z1;R)r)�LzL;2I)r3zL;2IR)r3zL;2)r3zL;2R)r)r3zL;4I)r3zL;4IR)r3zL;4)r3zL;4R)r%)r3zL;I)r3zL;IR)r3r3)r3zL;R)�)�I;16zI;12)�)r5r5)�I;16Br7)r5zI;16R)�I�I;16S)r8�I;16BS)r)� )�F�F;32F)r<�F;32BF)r8zI;32N)r8�I;32S)r8�I;32BS)r%r%)�LArA)r%r%r%)�RGBrB)rBzRGB;R)r%r%r%r%)�RGBArC�r)�RGBXrE)r%r%r%r%r%�rr)rE�RGBXX)r%r%r%r%r%r%)rrr)rE�RGBXXX)rC�RGBa)rr)rC�RGBaX)rrr)rC�RGBaXX)rr)rC�RGBAX)rrr)rC�RGBAXX)i�)r6r6r6)rBzRGB;16L)rBzRGB;16B)r6r6r6r6)rCzRGBA;16L)rCzRGBA;16B)rEzRGBX;16L)rEzRGBX;16B)rCzRGBa;16L)rCzRGBa;16B)�PzP;1)rNzP;1R)rNzP;2)rNzP;2R)rNzP;4)rNzP;4R)rNrN)�PArO)rNzP;R)�CMYKrP)rP�CMYKX)rP�CMYKXX)rPzCMYK;16L)rBrE)�LABrSc#�8K�|]}t|d����y�w)rN)�len)�.0�key_tps  �5/usr/lib/python3/dist-packages/PIL/TiffImagePlugin.py�	<genexpr>rY
s����A�V�#�f�Q�i�.�A�s�)�MM*�II*sMM*sII*sMM+sII+c��|ddtvS�Nr)�PREFIXES��prefixs rX�_acceptras���"�1�:��!�!�c�x�t|�dkD}t|rd|zn|�j|�}|r|ddd�S|S)Nr���)�abs�IFDRational�limit_rational)�val�max_val�inv�n_ds    rX�_limit_rationalrlsA��

�c�(�Q�,�C�
��a�#�g�#�
.�
=�
=�g�
F�C��3�t��t�9�$��$rbc���t|�}|j|jf}t|�|krt	|t|��}t
|�|kDrt|�}t	||�}|S�N)r�	numerator�denominator�minrlre�max)rhri�min_val�fracrks     rX�_limit_signed_rationalru sa���C�=�D�
�.�.�$�*�*�
*�C�
�3�x�'���c�3�w�<�0��
�3�x�'����n���c�7�+���Jrbc�.�eZdZdZ	dZd)d�Zed��Zed��Zd�Z	d�Z
d�Zd	�Zd
�Z
d�Zd�Z	ed
�Zed�Zed�Zed�Zed�Zed�Zed�Zed�Zed�Zed�Zed�Zed�Zed�Zed�Zed�Zed�Zed�Z ed�Z!ed�Z"ed �Z#ed!�Z$ed"�Z%ed#�Z&ed$�Z'ed%�Z(ed&�Z)e*e+d'�r	ed'�Z,y(y()*rfz�Implements a rational class where 0/0 is a legal value to match
    the in the wild use of exif rationals.

    e.g., DigitalZoomRatio - 0.00/0.00  indicates that no digital zoom was used
    )�
_numerator�_denominator�_valc��t|t�r4|j|_|j|_|j|_yt|t�r#|j|_|j|_n||_||_|dk(rtd�|_y|dk(rt|�|_yt||�|_y)z�
        :param value: either an integer numerator, a
        float/rational/other number, or an IFDRational
        :param denominator: Optional integer denominator
        Nr�nanr)	�
isinstancerfrorwrprxryr�float)�self�valuerps   rX�__init__zIFDRational.__init__Cs����e�[�)�#�o�o�D�O� %� 1� 1�D���
�
�D�I���e�X�&�#�o�o�D�O� %� 1� 1�D��#�D�O� +�D���!���e��D�I�
�A�
� ���D�I� ���4�D�Irbc��|jSrn)rw�r~s rXrozIFDRational.numerator]s�����rbc��|jSrn)rxr�s rXrpzIFDRational.denominatoras��� � � rbc��|jdk(r|j|jfS|jj|�}|j|jfS)z�

        :param max_denominator: Integer, the maximum denominator value
        :returns: Tuple of (numerator, denominator)
        r)rprory�limit_denominator)r~�max_denominator�fs   rXrgzIFDRational.limit_rationalesN�����q� ��>�>�4�#3�#3�3�3��I�I�'�'��8���{�{�A�M�M�)�)rbc�>�tt|j��Srn)�strr}ryr�s rX�__repr__zIFDRational.__repr__rs���5����#�$�$rbc�6�|jj�Srn)ry�__hash__r�s rXr�zIFDRational.__hash__us���y�y�!�!�#�#rbc��|j}t|t�r|j}t|t�rt|�}||k(Srn)ryr|rfr})r~�otherrhs   rX�__eq__zIFDRational.__eq__xs;���i�i���e�[�)��J�J�E��e�U�#���*�C��e�|�rbc�H�|j|j|jgSrn)ryrwrxr�s rX�__getstate__zIFDRational.__getstate__�s���	�	�4�?�?�D�,=�,=�>�>rbc�f�tj|d�|\}}}||_||_||_y)Nr)rfr�ryrwrx)r~�stateryrwrxs     rX�__setstate__zIFDRational.__setstate__�s4�����T�1�%�).�&��j�,���	�$���(��rbc����fd�}|S)Nc�6��t|j��|�Srn)�getattrry)r~�args�ops  �rX�delegatez'IFDRational._delegate.<locals>.delegate�s���)�7�4�9�9�b�)�4�0�0rbr1)r�r�s` rX�	_delegatezIFDRational._delegate�s���	1��rb�__add__�__radd__�__sub__�__rsub__�__mul__�__rmul__�__truediv__�__rtruediv__�__floordiv__�
__rfloordiv__�__mod__�__rmod__�__pow__�__rpow__�__pos__�__neg__�__abs__�	__trunc__�__lt__�__gt__�__le__�__ge__�__bool__�__ceil__�	__floor__�	__round__�__int__Nr0)-�__name__�
__module__�__qualname__�__doc__�	__slots__r��propertyrorprgr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r��hasattrrr�r1rbrXrfrf5s�����
7�I�5�4�����!��!�*�%�$��?�)����	�"�G���$�H��	�"�G���$�H��	�"�G���$�H��M�*�K��^�,�L��^�,�L��o�.�M��	�"�G���$�H��	�"�G���$�H��	�"�G��	�"�G��	�"�G��+�&�I�
�x�
 �F�
�x�
 �F�
�x�
 �F�
�x�
 �F���$�H���$�H��+�&�I��+�&�I��x��#��I�&��$rbrfc�,�eZdZdZd;d�Zed��Zed��Zed��Zejd��Zd�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zeeeej8ddfej:ddfej<ddfej>ddfej@dd fejBd!d"fejDd#d$fejFddfejHd%d&fg	��ed'd'�d<d(��Z%ed'�d)��Z&ed*d'�d<d+��Z'ed*�d,��Z(ed-d.�d<d/��Z)ed-�d0��Z*ed1d'�d<d2��Z+ed1�d3��Z,ed4d.�d<d5��Z-ed4�d6��Z.d7�Z/d8�Z0d=d9�Z1d:�Z2y)>�ImageFileDirectory_v2aThis class represents a TIFF tag directory.  To speed things up, we
    don't decode tags unless they're asked for.

    Exposes a dictionary interface of the tags in the directory::

        ifd = ImageFileDirectory_v2()
        ifd[key] = 'Some Data'
        ifd.tagtype[key] = TiffTags.ASCII
        print(ifd[key])
        'Some Data'

    Individual values are returned as the strings or numbers, sequences are
    returned as tuples of the values.

    The tiff metadata type of each item is stored in a dictionary of
    tag types in
    :attr:`~PIL.TiffImagePlugin.ImageFileDirectory_v2.tagtype`. The types
    are read from a tiff file, guessed from the type added, or added
    manually.

    Data Structures:

        * ``self.tagtype = {}``

          * Key: numerical TIFF tag number
          * Value: integer corresponding to the data type from
            :py:data:`.TiffTags.TYPES`

          .. versionadded:: 3.0.0

    'Internal' data structures:

        * ``self._tags_v2 = {}``

          * Key: numerical TIFF tag number
          * Value: decoded data, as tuple for multiple values

        * ``self._tagdata = {}``

          * Key: numerical TIFF tag number
          * Value: undecoded byte string from file

        * ``self._tags_v1 = {}``

          * Key: numerical TIFF tag number
          * Value: decoded data in the v1 format

    Tags will be found in the private attributes ``self._tagdata``, and in
    ``self._tags_v2`` once decoded.

    ``self.legacy_api`` is a value for internal use, and shouldn't be changed
    from outside code. In cooperation with
    :py:class:`~PIL.TiffImagePlugin.ImageFileDirectory_v1`, if ``legacy_api``
    is true, then decoded tags will be populated into both ``_tags_v1`` and
    ``_tags_v2``. ``_tags_v2`` will be used if this IFD is used in the TIFF
    save routine. Tags should be read from ``_tags_v1`` if
    ``legacy_api == true``.

    Nc���t|�sdt|��d�}t|��|�|n|dd|_|jtk(rd|_n(|jtk(rd|_n
d}t|��|ddk(|_||_i|_		|j�|jr|jd	|d
d�n|jd|dd�\|_d
|_
y)a�Initialize an ImageFileDirectory.

        To construct an ImageFileDirectory from a real file, pass the 8-byte
        magic header to the constructor.  To only set the endianness, pass it
        as the 'prefix' keyword argument.

        :param ifh: One of the accepted magic headers (cf. PREFIXES); also sets
              endianness.
        :param prefix: Override the endianness of the file.
        znot a TIFF file (header z not valid)Nr�>�<znot a TIFF IFD�+�Qr%r3rF)ra�repr�SyntaxError�_prefix�MM�_endian�II�_bigtiff�group�tagtype�reset�_unpack�next�_legacy_api)r~�ifhr`r��msgs     rXr�zImageFileDirectory_v2.__init__�s����s�|�,�T�#�Y�K�{�C�C��c�"�"�!'�!3�v��R�a�����<�<�2���D�L�
�\�\�R�
��D�L�"�C��c�"�"��A��"���
���
����'��
�
��*.�-�-�D�L�L��c�!�"�g�&�T�\�\�#�s�ST�SU�w�=W�	���!��rbc��|jSrn)r�r�s rX�<lambda>zImageFileDirectory_v2.<lambda>�
��4�<�<�rbc��|jSrn)�_offsetr�s rXr�zImageFileDirectory_v2.<lambda>r�rbc��|jSrn)r�r�s rXr�zImageFileDirectory_v2.<lambda>s��t�'7�'7�rbc��d}t|��)Nz"Not allowing setting of legacy api)�	Exception)r~rr�s   rX�
legacy_apiz ImageFileDirectory_v2.legacy_apis��2����n�rbc�X�i|_i|_i|_i|_d|_d|_yrn)�_tags_v1�_tags_v2�_tagdatar��_nextr�r�s rXr�zImageFileDirectory_v2.resets,����
���
���
������
���rbc�*�tt|��Srn)r��dictr�s rX�__str__zImageFileDirectory_v2.__str__%s���4��:��rbc��|j�D��cic]0\}}tj||j�j|��2c}}Scc}}w)z�
        :returns: dict of name|key: value

        Returns the complete tag dictionary, with named tags where possible.
        )�itemsr�lookupr��name)r~�coders   rX�namedzImageFileDirectory_v2.named(sH�� $�z�z�|�
���e�
�O�O�D�$�*�*�-�2�2�E�9�
�	
��
s�5A
c�j�tt|j�t|j�z�Srn)rU�setr�r�r�s rX�__len__zImageFileDirectory_v2.__len__3�$���3�t�}�}�%��D�M�M�(:�:�;�;rbc��||jvrG|j|}|j|}|j|\}}||||j�||<|j|}|jrt|ttf�s|f}|Srn)r�r�r��_load_dispatchr�r|�tuple�bytes)r~�tag�data�typ�size�handlerrhs       rX�__getitem__z!ImageFileDirectory_v2.__getitem__6s����d�m�m�#��=�=��%�D��,�,�s�#�C� �/�/��4�M�D�'���d�D�O�O�<�D��I��m�m�C� ���?�?�:�c�E�5�>�#B��&�C��
rbc�>�||jvxs||jvSrn)r�r��r~r�s  rX�__contains__z"ImageFileDirectory_v2.__contains__A����d�m�m�#�;�s�d�m�m�';�;rbc�>�|j|||j�yrn)�_setitemr�)r~r�rs   rX�__setitem__z!ImageFileDirectory_v2.__setitem__Ds���
�
�c�5�$�/�/�2rbc	��	�tttf}tj||j
��	t
||�r|gn|}||jv�r؉	jr�	j|j|<�n�tj|j|<td�|D��rAtd�|D��rtjntj|j|<�nAtd�|D��r�td�|D��rtj|j|<n�td�|D��rtj|j|<n�td�|D��rtjntj |j|<n�td�|D��rtj"|j|<n_td�|D��rtj$|j|<n/td	�|D��rtj&|j|<|j|tjk(r2|D�cgc]&}t
|t�r|j)d
d�n|��(}}nJ|j|tjk(r*|D�cgc]}t
|t*�rt-|�n|��!}}|j|tjk(xrt
|t.�}|st1�	fd�|D��}|r|j2n|j4}|s��	j6d
k(s<|j|tj&k(s�	j6�Mt9|�d
k(r?|s=|r2|j|tjtjfvr|f}	|\||<y|||<ycc}wcc}w#t:$r0t=j>d|�dt9|��d��|d||<YywxYw)Nc3�<K�|]}t|t����y�wrn)r|rf�rV�vs  rXrYz1ImageFileDirectory_v2._setitem.<locals>.<genexpr>Rs����B�a�z�!�[�1�B���c3�&K�|]	}|dk\���y�w�rNr1rs  rXrYz1ImageFileDirectory_v2._setitem.<locals>.<genexpr>Us����6�!�q�A�v�6���c3�<K�|]}t|t����y�wrn)r|�intrs  rXrYz1ImageFileDirectory_v2._setitem.<locals>.<genexpr>X�����<���A�s�+�<�rc3�<K�|]}d|cxkxrdknc���y�w)rrNr1rs  rXrYz1ImageFileDirectory_v2._setitem.<locals>.<genexpr>Ys����:�a�1��>�E�>�>�:�rc3�<K�|]}d|cxkxrdknc���y�w)i���i�Nr1rs  rXrYz1ImageFileDirectory_v2._setitem.<locals>.<genexpr>[s����B�a�X��1�E�1�1�B�rc3�&K�|]	}|dk\���y�wrr1rs  rXrYz1ImageFileDirectory_v2._setitem.<locals>.<genexpr>`s����":�a�1��6�":�rc3�<K�|]}t|t����y�wrn)r|r}rs  rXrYz1ImageFileDirectory_v2._setitem.<locals>.<genexpr>c�����>�!��A�u�-�>�rc3�<K�|]}t|t����y�wrn)r|r�rs  rXrYz1ImageFileDirectory_v2._setitem.<locals>.<genexpr>er
rc3�<K�|]}t|t����y�wrn)r|r�rs  rXrYz1ImageFileDirectory_v2._setitem.<locals>.<genexpr>grr�ascii�replacec3�@�K�|]}�j|����y�wrn)�cvt_enum)rVr�infos  �rXrYz1ImageFileDirectory_v2._setitem.<locals>.<genexpr>ts�����D�E�4�=�=��/�D�s�rzMetadata Warning, tag z had too many entries: z, expected 1r) rr�r�rr�r�r|r��type�	UNDEFINED�all�RATIONAL�SIGNED_RATIONAL�SHORT�SIGNED_SHORT�LONG�SIGNED_LONG�DOUBLE�ASCII�BYTE�encoder	r}r�r�r�r��lengthrU�
ValueError�warnings�warn)
r~r�rr��	basetypes�valuesr�is_ifd�destrs
         @rXr�zImageFileDirectory_v2._setitemGsE����U�C�(�	����s�D�J�J�/��&�u�i�8�%��e���d�l�l�"��y�y�$(�I�I����S�!�$,�$6�$6����S�!��B�6�B�B��6�v�6�6�!�)�)�%�5�5��L�L��%�
�<�V�<�<��:�6�:�:�,4�N�N����S�)��B�6�B�B�,4�,A�,A����S�)� #�":�6�":�:�%�M�M�!)�!5�!5����S�)�
�>�v�>�>�(0���D�L�L��%��<�V�<�<�(0���D�L�L��%��>�v�>�>�(0�
�
�D�L�L��%��<�<���� 2� 2�2� ���1;�1�c�0B�����)�,��I��F���\�\�#�
�(�"3�"3�
3�EK�L��*�Q��"4�e�A�h�!�;�L�F�L����c�"�h�m�m�3�P�
�6�4�8P����D�V�D�D�F� *�t�}�}��
�
���
�[�[�A�
��|�|�C� �H�M�M�1����#��F��q�(8���d�l�l�3�/��!�!��(�(�4��!���
&�%���c���D��I��U��
M��4�
&��
�
�,�S�E�1H��6�{�m�<�1��#�1�I��S�	�

&�s�+N9�!$N>�+O�6O<�;O<c��|jj|d�|jj|d�|jj|d�yrn)r��popr�r�r�s  rX�__delitem__z!ImageFileDirectory_v2.__delitem__�s>���
�
���#�t�$��
�
���#�t�$��
�
���#�t�$rbc�j�tt|j�t|j�z�Srn)�iterr�r�r�r�s rX�__iter__zImageFileDirectory_v2.__iter__��$���C��
�
�&��T�]�]�);�;�<�<rbc�H�tj|j|z|�Srn)�struct�unpackr�)r~�fmtr�s   rXr�zImageFileDirectory_v2._unpack�s���}�}�T�\�\�C�/��6�6rbc�H�tj|j|zg|���Srn)r4�packr�)r~r6r)s   rX�_packzImageFileDirectory_v2._pack�s���{�{�4�<�<�#�-�7��7�7rbc������fd�}|S)Nc���ddlm}|jjd�r"|jddj	dd�|�<�|ft
�<|S)Nrr�load_r�_� )rrr��
startswithrr�)�funcr�idxr�s  ��rX�	decoratorz9ImageFileDirectory_v2._register_loader.<locals>.decorator�sL���'��}�}�'�'��0�!�]�]�1�2�.�6�6�s�C�@��c�
�"&��*�N�3���Krbr1)rAr�rBs`` rX�_register_loaderz&ImageFileDirectory_v2._register_loader�s���	��rbc����fd�}|S)Nc���|t�<|Srn)�_write_dispatch)r@rAs �rXrBz9ImageFileDirectory_v2._register_writer.<locals>.decorator�s���#'�O�C� ��Krbr1)rArBs` rX�_register_writerz&ImageFileDirectory_v2._register_writer�s���	��rbc����ddlm}|\}�}|||<tjd�z���d��fd�	ft|<�fd�t
|<y)Nrr�=c�H��|jt|��z����|�Srn)r�rU)r~r�r�r6r�s   ��rXr�z7ImageFileDirectory_v2._register_basic.<locals>.<lambda>�s)�������D�	�T� 1�2�3�%�8�$�?�rbc�<���dj��fd�|D��S)Nrbc3�B�K�|]}�j�|����y�wrn)r9)rVrr6r~s  ��rXrYzJImageFileDirectory_v2._register_basic.<locals>.<lambda>.<locals>.<genexpr>�s�����@��T�Z�Z��U�+�@�s���join)r~r)r6s` �rXr�z7ImageFileDirectory_v2._register_basic.<locals>.<lambda>�s����H�H�@��@�@�rb�T)rrr4�calcsizer�rF)�idx_fmt_namerrAr�r6r�s    @@rX�_register_basicz%ImageFileDirectory_v2._register_basic�sL���#�%���S�$���c�
����s�S�y�)���
�
��s�� 
���rb�H�shortr3�long�bzsigned byte�hzsigned short�lzsigned longr�r}�d�doubler��long8rc��|Srnr1�r~r�r�s   rX�	load_bytezImageFileDirectory_v2.load_byte�����rbc�t�t|t�rt|�}t|t�rt|f�}|Srn)r|rfr	r��r~r�s  rX�
write_bytez ImageFileDirectory_v2.write_byte�s/���d�K�(��t�9�D��d�C� ��$��>�D��rbrc�R�|jd�r|dd}|jdd�S)N�rdzlatin-1r)�endswith�decoder]s   rX�load_stringz!ImageFileDirectory_v2.load_string�s*���=�=������9�D��{�{�9�i�0�0rbc��t|t�rt|�}t|t�s|j	dd�}|dzS)Nrrrd)r|r	r�r�r#�r~rs  rX�write_stringz"ImageFileDirectory_v2.write_string�s;���e�S�!���J�E��%��'��L�L��)�4�E��u�}�rbrr%c
����|jt|�dz�d�|�}�fd��t�fd�t|ddd�|ddd��D��S)Nrr3c�(���r||fSt||�Srn�rf��arVr�s  �rX�combinez4ImageFileDirectory_v2.load_rational.<locals>.combine�����'�A�q�6�>�[��A�->�>rbc3�6�K�|]\}}�||����y�wrnr1�rV�num�denomrps   �rXrYz6ImageFileDirectory_v2.load_rational.<locals>.<genexpr>�������V�Z�S�%�W�S�%�(�V���rr�r�rUr��zip�r~r�r��valsrps  ` @rX�
load_rationalz#ImageFileDirectory_v2.load_rational��U����|�|�s�4�y�A�~�.�a�0�$�7��	?��V�3�t�C�a�C�y�$�q�t�RS�t�*�;U�V�V�Vrbc�8��dj�fd�|D��S)Nrbc3�X�K�|]!}�jdgt|d�������#y�w)�2Ll��N)r9rl�rVrtr~s  �rXrYz7ImageFileDirectory_v2.write_rational.<locals>.<genexpr>�s-�����
�DH�J�D�J�J�t�?�o�d�I�>�?�
�s�'*rM�r~r)s` rX�write_rationalz$ImageFileDirectory_v2.write_rational�s!����x�x�
�LR�
�
�	
rbr#c��|Srnr1r]s   rX�load_undefinedz$ImageFileDirectory_v2.load_undefinedr_rbc�\�t|t�rt|�jdd�}|S)Nrr)r|r	r�r#ris  rX�write_undefinedz%ImageFileDirectory_v2.write_undefineds'���e�S�!���J�%�%�g�y�9�E��rb�
c
����|jt|�dz�d�|�}�fd��t�fd�t|ddd�|ddd��D��S)NrrXc�(���r||fSt||�Srnrmrns  �rXrpz;ImageFileDirectory_v2.load_signed_rational.<locals>.combinerqrbc3�6�K�|]\}}�||����y�wrnr1rss   �rXrYz=ImageFileDirectory_v2.load_signed_rational.<locals>.<genexpr>rvrwrrrxrzs  ` @rX�load_signed_rationalz*ImageFileDirectory_v2.load_signed_rationalr}rbc�8��dj�fd�|D��S)Nrbc	3�Z�K�|]"}�jdgt|dd�������$y�w)�2li���i�N)r9rur�s  �rXrYz>ImageFileDirectory_v2.write_signed_rational.<locals>.<genexpr>s3�����
��
�D�J�J�t�P�4�T�9�h�O�P�
�s�(+rMr�s` rX�write_signed_rationalz+ImageFileDirectory_v2.write_signed_rationals!����x�x�
��
�
�	
rbc�~�|j|�}t|�|k7rd|�dt|��d�}t|��|S)Nz&Corrupt EXIF data.  Expecting to read � bytes but only got z. )�readrU�OSError)r~�fpr��retr�s     rX�_ensure_readz"ImageFileDirectory_v2._ensure_readsN���g�g�d�m���s�8�t��%�%)�F�*>�s�3�x�j��L�
��#�,���
rbc
�x�|j�|j�|_	|jr"|j	d|j|d��n!|j	d|j|d��d}t
|�D�]}|jr"|j	d|j|d��n!|j	d|j|d	��\}}}}tj||j�j}tj|d
�}	d|�d|�d
|	�d|�d�	}
	|j|\}}||z}
|
|jrdndkDrv|j�}|j	|jrdnd|�\}|
d|�d|��z
}
|j#|�t%j&||
�}|j#|�n|d|
}t)|�|
k7r>t+j,d|
�dt)|��d|���tj!|
����|stj!|
����||j.|<||j0|<|
d|
dkDrd|
zn
t3|�zz
}
tj!|
���|jr"|j	d|j|d��n!|j	d|j|d��\|_y#t$rtj!d|
|�Y��wxYw#t6$r(}
t+j,t9|
��Yd}
~
yd}
~
wwxYw)Nr�r%rSrr�HHQ8s��HHL4sr4�unknownztag: � (�
) - type: �)z%s - unsupported type %srr3z Tag Location: z - Data Location: z/Possibly corrupt EXIF data.  Expecting to read r�z. Skipping tag �
 - value: r;�<table: %d bytes>)r��tellr�r�r�r��rangerr�r�r�r�getr��KeyError�logger�debug�seekr�
_safe_readrUr&r'r�r�r�r�r�r�)r~r��	tag_count�ir�r��countr��tagname�typnamer��	unit_sizer�r��here�offsets                rX�loadzImageFileDirectory_v2.load&s���
�
���w�w�y���=	��=�=����S�$�"3�"3�B��":�;��\�\�#�t�'8�'8��Q�'?�@��	�I�
�9�%�.
"���}�}��L�L��$�*;�*;�B��*C�D����g�t�/@�/@��R�/H�I�&��S�%��#�/�/�#�t�z�z�:�?�?���)�)�C��3���g�Y�b���Z��y��3�%�q�I���)-�)<�)<�S�)A�&�I�w��y�(����
�
�1�1�5��7�7�9�D� $���D�M�M�S�s�D� Q�I�V��_�T�F�2D�V�H�M�M�C��G�G�F�O�$�/�/��D�9�D��G�G�D�M����;�D��t�9��$��M�M�-�-1�F�2F�s�4�y�k�R)�),��/��
�L�L��%����L�L��%��%)��
�
�c�"�$'����S�!��|�26��)�'�$�.��d��������S�!�].
"�d�=�=����S�$�"3�"3�B��":�;��\�\�#�t�'8�'8��Q�'?�@�
�T�Y��G ���L�L�!;�S�#�F����P�	��M�M�#�c�(�#���	�s=�DL�.K!�F L�! L�L�L�L�	L9�L4�4L9c�F�|jdt|j��}g}|t|�zt|j�dzzdz}d}t|jj	��D�]\\}}|t
k(rt|�}|jj|�}tjd||t|��|tjk(xrt|t�}|r_|jdk(rd}	nd}	t!|	|��}
|j|}|j	�D]
\}}
|
|
|<�|
j#|�}n+t|t$�r|n|f}|j&||g|���}tj(||j*�j,}|rd	nt/j|d
�}d|�d|�d
|�d|�d�	}|dt|�dk\rdt|�zn
t1|�zz
}tj|�|rd}nH|tj2tj4tj6fvrt|�}nt|�}t|�dkr(|j9||||j;dd�df��� |j9||||jd|�|f�|t|�dzdzdzz
}��_|�L||\}}}}}|r
d}t=|��|jd|j?d|�d|z�}|||||f||<|D]L\}}}}}tjd|||t|�t|��||jd||||�z
}�N|dz
}|D]!\}}}}}||z
}t|�dzs�|dz
}�#|S)NrSr4rzTag %s, Type: %s, Value: %sr�sII*sMM*)r��ifdr�zsave: r�r�r�r�r6r�rrdrbr3rz&multistrip support not yet implementedrz%s %s %s %s %sr�s) r9rUr��sortedr��STRIPOFFSETSr�r�r�r�r�rrr|r�r�r��tobytesr�rFr�r�r�rr�r"r!r�append�ljust�NotImplementedErrorr�)r~r��result�entries�stripoffsetsr�rr�r*r�r�r)�ifd_tag�	ifd_valuer�r�r�r�r�s                   rXr�zImageFileDirectory_v2.tobytesis������C��T�]�]�!3�4�����#�f�+�%��D�M�M�(:�R�(?�?�!�C����!����!4�!4�!6�7�(	3�J�C���l�"�"�7�|���,�,�"�"�3�'�C��L�L�6��S�$�u�+�N��H�M�M�)�E�j���.E�F���<�<�3�&�7�C�7�C�+�C�s�;�����s�+��*0�,�,�.�-�&�G�Y�#,�C��L�-��{�{�6�*��",�U�E�":�����0�t�+�+�C�0��?��?���o�o�c�4�:�:�6�;�;�G�%�e�5�9�9�S�)�+D�G��7�)�2�c�U�*�W�I�R��u�A�F�C��<�36�t�9��?�#�c�$�i�/��F���
�C�
�L�L��������������8J�8J�K�K��D�	���F����4�y�A�~�����S�%����A�u�1E�s�K�L�����S�%����C��1H�$�O�P��3�t�9�q�=�Q�.��2�2��Q(	3�V�#�+2�<�+@�(�C��e�U�D��>��)�#�.�.��J�J�s�D�L�L��e�$<�Q�$?�&�$H�I�E�$'��e�U�D�$@�G�L�!�-4�	B�(�C��e�U�D��L�L�)�3��U�D��K��d��T��d�j�j��#�s�E�5�A�A�F�	B�
	�+���-4�	 �(�C��e�U�D��d�N�F��4�y�1�}��%���	 �
�
rbc��|j�dk(r/|j|j|jddd�z�|j�}|j	|�}|j|�|t|�zS)Nr�HL�*r%)r��writer�r9r�rU)r~r�r�r�s    rX�savezImageFileDirectory_v2.save�se��
�7�7�9��>��H�H�T�\�\�D�J�J�t�R��$;�;�<���������f�%��
�������F��#�#rb)sII*NNrOrD)3r�r�r�r�r�r�r`r�r��setterr�r�r�r�r�r�r�r�r.r1r�r9rCrGrR�list�maprrr�SIGNED_BYTErr�FLOATr �IFD�LONG8r^rbrgrjr|r�r�r�r�r�r�r�r�r�r1rbrXr�r��sT��:�x!�@�/�
0�F�
�/�
0�F��7�8�J���������	
�<�	�<�3�N�`%�
=�7�8�	��
� 	�������g�.�����V�,��%�%�s�M�:��&�&��^�<��%�%�s�M�:�����g�.����#�x�0����s�F�+�����g�.�

�
	
��"�a�������a������a���1��1�
�a������a���W��W��a��
��
�
�a�������a�����
�b�!��W��W��b��
��
��A�FK�Z$rbr�r>r=r<�write_c���eZdZUdZ�fd�Zed��Zed��Zded<	e	d��Z
d�Zd	�Zd
�Z
d�Zd�Zd
�Z�xZS)�ImageFileDirectory_v1a�This class represents the **legacy** interface to a TIFF tag directory.

    Exposes a dictionary interface of the tags in the directory::

        ifd = ImageFileDirectory_v1()
        ifd[key] = 'Some Data'
        ifd.tagtype[key] = TiffTags.ASCII
        print(ifd[key])
        ('Some Data',)

    Also contains a dictionary of tag types as read from the tiff image file,
    :attr:`~PIL.TiffImagePlugin.ImageFileDirectory_v1.tagtype`.

    Values are returned as a tuple.

    ..  deprecated:: 3.0.0
    c�2��t�|�|i|��d|_y)NT)�superr�r�)r~r��kwargs�	__class__s   �rXr�zImageFileDirectory_v1.__init__�s���
���$�)�&�)���rbc��|jSrn)r�r�s rXr�zImageFileDirectory_v1.<lambda>�s
�����rbc��|jSrn)r�r�s rXr�zImageFileDirectory_v1.<lambda>�s
��D�M�M�rbr�r�c��||j��}|j|_|j|_|j|_|S)a2Returns an
        :py:class:`~PIL.TiffImagePlugin.ImageFileDirectory_v1`
        instance with the same data as is contained in the original
        :py:class:`~PIL.TiffImagePlugin.ImageFileDirectory_v2`
        instance.

        :returns: :py:class:`~PIL.TiffImagePlugin.ImageFileDirectory_v1`

        r_)r`r�r�r�)�cls�originalr�s   rX�from_v2zImageFileDirectory_v1.from_v2�s<������)���(�(����&�&����=�=����
rbc���t|j��}t|j�|_t|j�|_t|j
�|_|S)a2Returns an
        :py:class:`~PIL.TiffImagePlugin.ImageFileDirectory_v2`
        instance with the same data as is contained in the original
        :py:class:`~PIL.TiffImagePlugin.ImageFileDirectory_v1`
        instance.

        :returns: :py:class:`~PIL.TiffImagePlugin.ImageFileDirectory_v2`

        r_)r�r`r�r�r�r�)r~r�s  rX�to_v2zImageFileDirectory_v1.to_v2�sG��$�4�;�;�7���D�M�M�*����4�<�<�(����D�M�M�*����
rbc�>�||jvxs||jvSrn)r�r�r�s  rXr�z"ImageFileDirectory_v1.__contains__r�rbc�j�tt|j�t|j�z�Srn)rUr�r�r�r�s rXr�zImageFileDirectory_v1.__len__r�rbc�j�tt|j�t|j�z�Srn)r0r�r�r�r�s rXr1zImageFileDirectory_v1.__iter__r2rbc�8�dD]}|j|||��y�N)FT)r�)r~r�rr�s    rXr�z!ImageFileDirectory_v1.__setitem__s!��'�	2�J��M�M�#�u�j�1�	2rbc	��||jvrR|j|}|j|}|j|\}}dD]}|j	|||||�|��|j|}t|ttf�s|f}|Sr�)r�r�r�r�r�r|r�r�)r~r�r�r�r�r��legacyrhs        rXr�z!ImageFileDirectory_v1.__getitem__s����d�m�m�#��=�=��%�D��,�,�s�#�C� �/�/��4�M�D�'�'�
H���
�
�c�7�4��v�#>��G�
H��m�m�C� ���#��u�~�.��&�C��
rb)r�r�r�r�r�r��tags�tagdata�__annotations__�classmethodr�r�r�r�r1r�r��
__classcell__�r�s@rXr�r��s_����$ ��.�/�D��1�2�G��M�!�����"�"<�<�=�2�
rbr�c�|��eZdZdZdZdZd�fd�	Zd�Zed��Z	d�Z
d�Zd	�Zd
�Z
d�Z�fd�Zd
�Zd�Zd�Z�xZS)�
TiffImageFile�TIFFz
Adobe TIFFFc�F��d|_	d|_	t�|�
||�yrn)�tag_v2r�r�r�)r~r��filenamer�s   �rXr�zTiffImageFile.__init__3s&������5����"�
����X�&rbc��|jjd�}|ddk(r||jjd�z
}t|�|_d|_|jj
x|_|_d|_|j|_	g|_
d|_tjd�tjd|j�tjdt|��|jd	�y)
z#Open the first image in a TIFF filer%rr�Nrdz*** TiffImageFile._open ***z
- __first: %sz	- ifh: %sr)r�r�r�r�r�r��_TiffImageFile__first�_TiffImageFile__next�_TiffImageFile__frame�_fp�
_frame_pos�	_n_framesr�r�r��_seek)r~r�s  rX�_openzTiffImageFile._open<s����g�g�l�l�1�o���q�6�R�<��4�7�7�<�<��?�"�C�+�C�0������&*�[�[�%5�%5�5���t�{�����7�7������������2�3����_�d�l�l�3����[�$�s�)�,�	
�
�
�1�
rbc�2�|j��|j�}|jt|j��|j�/|j|j�dz�|j��/|j|�|jS)Nr)r�r�r�rUr�r�)r~�currents  rX�n_frameszTiffImageFile.n_framesWsn���>�>�!��i�i�k�G��J�J�s�4�?�?�+�,��.�.�(��
�
�4�9�9�;��?�+��.�.�(��I�I�g���~�~�rbc��|j|�sy|j|�tj|j�tj
j
|j|j�|_y)z%Select a given frame as current imageN)	�_seek_checkr�r
�_decompression_bomb_checkr��core�new�mode�im)r~�frames  rXr�zTiffImageFile.seekasQ������&���
�
�5��	�'�'��	�	�2��*�*�.�.����D�I�I�6��rbc�2�|j|_|jj�t|j�|k�r�|j
s
d}t
|��tjd||j|j
|jj��|jj|j
�|jj|j
�tjd|jj��|jj|j�|jj|jvrd|_n|jj|_|j
dk(r
|dz|_t|j�dk(r|j
dk7|_|xjdz
c_	t|j�|kr���|jj|j|�|jj|j�|j#�t$j'|j�x|_|_||_	|j-�y)Nzno more images in TIFF filez9Seeking to frame %s, on frame %s, __next %s, location: %szLoading tags, location: %srr)r�r�r�rUr�r��EOFErrorr�r�r�r�r�r�r�r�r��is_animated�_reload_exifr�r�r�r��_setup)r~rr�s   rXr�zTiffImageFile._seekls����(�(���	
�������$�/�/�"�e�+��;�;�3���s�m�#��L�L�K��������������
�
�G�G�L�L����%��O�O�"�"�4�;�;�/��L�L�5�t�w�w�|�|�~�F��K�K���T�W�W�%��{�{���4�?�?�2� ���"�k�k�.�.����{�{�a��!&������4�?�?�#�q�(�#'�;�;�!�#3�� ��L�L�A��L�3�$�/�/�"�e�+�4	
�����T�_�_�U�+�,���������!�����3�;�;�D�K�K�H�H���4�8�������
rbc��|jS)zReturn the current frame number)r�r�s rXr�zTiffImageFile.tell�s���|�|�rbc�n�t|jvr"|j|jt�SiS)z�
        Returns a dictionary containing the XMP tags.
        Requires defusedxml to be installed.

        :returns: XMP tags in a dictionary.
        )�XMPr��_getxmpr�s rX�getxmpzTiffImageFile.getxmp�s,��25����1C�t�|�|�D�K�K��,�-�K��Krbc��i}|jjtjj�}|r�|dddk(r�t|dd�}t
j|ddzdz�dz}t|d|zd|z�}|d|zd|z|z}d|i||<|t
jd|z|zdz�dzd}|dddk(r��|S)	a5
        Returns a dictionary of Photoshop "Image Resource Blocks".
        The keys are the image resource ID. For more information, see
        https://www.adobe.com/devnet-apps/photoshop/fileformatashtml/#50577409_pgfId-1037727

        :returns: Photoshop "Image Resource Blocks" in a dictionary.
        Nrs8BIMr!rrr�r�)	r�r�r	�Base�ImageResources�i16�math�ceil�i32)r~�blocksrh�id�nr�r�s       rX�get_photoshop_blocksz"TiffImageFile.get_photoshop_blocks�s������k�k�o�o�h�m�m�:�:�;����b�q�'�W�$���Q�q��]���I�I�s�1�v��z�Q�.�/�!�3���3�q�1�u�r�A�v�.�/���2��6�B��F�T�M�2��$�d�^��r�
��$�)�)�R�!�V�d�]�a�$7�8�1�<�>�?���b�q�'�W�$��
rbc�p��|jr|jr|j�St�|��Srn)�tile�use_load_libtiff�
_load_libtiffr�r�)r~r�s �rXr�zTiffImageFile.load�s-����9�9��.�.��%�%�'�'��w�|�~�rbc��|js\d|_|jj�|j	�}t
jD]}||vr�|j|��tj|d��tjj|jvr&|jtjj=yy)NT)�in_place)r�!_close_exclusive_fp_after_loadingr�r��getexifr�TAGS_V2_GROUPS�get_ifdr�exif_transposer	r
�Orientationr�)r~�exif�keys   rX�load_endzTiffImageFile.load_end�s������59�D�2�
�G�G�L�L�N��<�<�>�D��.�.�
"���d�?�����S�!�
"�
	����t�4��=�=�$�$����3����H�M�M�5�5�6�4rbc���tjj|�|j�t|j�dk(s
d}t|��|jdd}t
|jdd�}	t|jd�xr|jj�}t|jd�r|jj�|r||d<tj|jd	t|�|j�}	|j|j |�|j$xr
|j&}t|jd�rBt(j+d
�|j-|jj/��\}}	n�|rGt(j+d�|s|jj1d�|j-d�\}}	n\t(j+d�|jj1d�|j-|jj3��\}}	g|_d|_|j7�|r!|jj9�d|_|	dkrt|	��tjj|�S#t
$rd}Y���wxYw#t"$r}d
}t|�|�d}~wwxYw)zWOverload method triggered when we detect a compressed tiff
        Calls out to libtiffrzNot exactly one tilerr�fileno�flushFr�libtiffzCouldn't set the imageN�getvaluez5have getvalue. just sending in a string from getvaluez3have fileno, calling fileno version of the decoder.sfpfpz+don't have fileno or getvalue. just reading)r
r��load_preparerUrr�r�r�r�r'r(�_getdecoderr�r��
decoderconfig�setimagerr%�
_exclusive_fprr�r�rfr*r�r��readonlyr%�close)
r~r��extentsr�r��decoder�e�
close_self_fpr�errs
          rXrzTiffImageFile._load_libtiff�sN��	������������4�9�9�~��"�(�C��#�,���)�)�A�,�q�/���D�I�I�a�L��O�$��

	�����(�+�@������0@�B��t�w�w��(����
�
����D��G��#�#��I�I�y�%��+�t�/A�/A�
��	&����T�W�W�g�.�
�*�*�C�4�3C�3C�/C�
��4�7�7�J�'�
�L�L�P�Q��^�^�D�G�G�$4�$4�$6�7�F�A�s�
��L�L�N�O� ������Q���^�^�G�,�F�A�s�
�L�L�F�G��G�G�L�L��O��^�^�D�G�G�L�L�N�3�F�A�s���	���
��
�
����G�G�M�M�O��D�G���7��#�,���{�{����%�%��q�	��B�	���	&�*�C��#�,�A�%��	&�s+�A"K�"K�K�K�	K4�!K/�/K4c�p�d|jvr
d}t|��t|jjtd�|_|jjtd�|_|jjtd�}|j
dk(rd}|jjtd�}tjd�tjd|j
�tjd	|�tjd
|j�tjd|�tjd|jjt��t|jjt��}t|jjt ��}||f|_tjd
|j$�|jjt&d�}t)|�dkDr"t+|�t-|�cxk(rdk(rnnd}|jjt.d�}|jjt0d�}|dvrd}	n
|dk(rd}	nd}	|	t)|�z
}	t)|�}
|jjt2|j
dk(r|dvrdnd�}|t4kDr#tj7d|�d}t9|��||
kr|d|}n||
kDr
|
dk(r||z}t)|�|k7r
d}t9|��|jj:|||||f}tjd|�	t<|\|_}
tjd|
�tjd|jB�|j
|jDd<|jjtFd�}|jjtHd�}|r�|r�|jjtJ�}|dk(r||f|jDd <nS|dk(r|d!z|d!zf|jDd <n6|�#||f|jDd <||f|jDd"<n||f|jDd"<dx}x}}g|_&tNxs|j
d#k7|_(|jPr�|dk(r5|dddz|ddz}tjd|�t<|\|_}
|
d$k(rd%}
d&|
vr|
jSd&d'�}
d(|
vr|
jSd(d'�}
|dk(r |j
d)k(r|jdk(rd*}
|
|j
d+|jjTf}|jLjWd,dd||fd|f��n�tX|jvstZ|jv�rutX|jvrC|jtX}|jjt\|�}|j$d}nQ|jtZ}|jjt^�}|jjt`�}|D]�}||z|kDr|tc|�zd-z}nd}|
}|jdk(r
|
|}||	z}|t|�df}|jLjW|j
||t-||z|�t-||z|�f||f�||z}||j$dk\s��d||z}}||j$dk\s��dx}}|dz
}��n"tjd.�d}t9|��td|jvr |jtd|jDd/<|jBd0vrW|jtfD�cgc]}ti|d1z���}}tkjld2d3jo|��|_8yy#t@$r(}tjd�d}t9|�|�d}~wwxYwcc}w)4z-Setup this image object based on current tagsi�z+Windows Media Photo files not yet supportedrrr"r!z*** Summary ***z- compression: %sz - photometric_interpretation: %sz- planar_configuration: %sz- fill_order: %sz- YCbCr subsampling: %sz
- size: %sr0r1)rr!r%rrr)rr!z.More samples per pixel than can be decoded: %sz#Invalid value for samples per pixelNzunknown data organizationzformat key: %sz- unsupported formatzunknown pixel modez- raw mode: %sz- pil mode: %s�compressionr�dpigR���Q@�
resolutionrr5�I;16Nz;16Bz;16Nz;16Lr$rBFr)r%z- unsupported data organization�icc_profile�rNrOr�RGB;Lrb)9r�r��COMPRESSION_INFOr��COMPRESSION�_compression�PLANAR_CONFIGURATION�_planar_configuration�PHOTOMETRIC_INTERPRETATION�	FILLORDERr�r�r��YCBCRSUBSAMPLINGr	�
IMAGEWIDTH�IMAGELENGTH�_sizer��SAMPLEFORMATrUrrrq�
BITSPERSAMPLE�EXTRASAMPLES�SAMPLESPERPIXEL�MAX_SAMPLESPERPIXEL�errorr�r`�	OPEN_INFO�_moder�r�r�X_RESOLUTION�Y_RESOLUTION�RESOLUTION_UNITr�READ_LIBTIFFrrr�r�r��TILEOFFSETS�ROWSPERSTRIP�	TILEWIDTH�
TILELENGTH�sum�
ICCPROFILE�COLORMAPrr
rrN�palette)r~r��photo�	fillorder�xsize�ysize�
sample_format�	bps_tuple�extra_tuple�	bps_count�bps_actual_count�samples_per_pixelr$�rawmoder4�xres�yres�resunit�x�y�layerro�offsetsrW�wr��stride�tile_rawmoderVr]s                              rXrzTiffImageFile._setup&sW���T�[�[� �?�C��#�,��-�T�[�[�_�_�[�!�-L�M���%)�[�[�_�_�5I�1�%M��"������ :�A�>������+��E��K�K�O�O�I�q�1�	����&�'����(�$�*;�*;�<����7��?����1�4�3M�3M�N����'��3����.������=M�0N�O��D�K�K�O�O�J�/�0���D�K�K�O�O�K�0�1���E�\��
����\�4�9�9�-�������d�;�
��}���!�c�-�&8�C�
�<N�&S�RS�&S�!�M��K�K�O�O�M�4�8�	��k�k�o�o�l�B�7���I���I�
�a�Z��I��I��S��%�%�	��y�>�� �K�K�O�O���"�"�k�1�e�v�o�A�1�
��
�2�2��L�L�@�BS�
�8�C��c�"�"��/�/�"�"4�#4�5�I�
�!1�
1�6F�!�6K�"�$5�5�I��y�>�.�.�-�C��c�"�"�
�K�K��������

��	���%�s�+�	*�"+�C�.��D�J��	���%�w�/����%�t�y�y�1�#'�#4�#4��	�	�-� ��{�{���|�Q�/���{�{���|�Q�/���D��k�k�o�o�o�6�G��!�|�$(�$�<��	�	�%� ��A��$(�4�K����#=��	�	�%� ���$(�$�<��	�	�%� �+/��*��	�	�,�'�*.��*��	�	�,�'�����A����	� ,� J��0A�0A�U�0J���� � ��A�~��"�1�g��n�s�1�2�w�.�����-�s�3�'0��n�#��
�G�
�&� �!���� �!�/�/�&�&�9���� �!�/�/�&�&�9��
��
��%�%��/��.�.�!�3����$�+�+�U�D�K�K�4F�4F�G�A��I�I���i�!�Q��u�)=�q�!�D�E�
�T�[�[�
(�K�4�;�;�,F��t�{�{�*��+�+�l�3���K�K�O�O�L�%�8���I�I�a�L���+�+�k�2���K�K�O�O�I�.���K�K�O�O�J�/��!�
#���q�5�5�=���Y��/�!�3�F��F�&���-�-��2�#*�5�>�L��i�'�F�!�3�v�;��2���	�	� � ��)�)��A�s�1�q�5�%�0�#�a�!�e�U�2C�D���	����E����	�	�!��$��a�!�e�q�A��D�I�I�a�L�(� !�	��A���
��7
#�:
�L�L�:�;�-�C��c�"�"�����$�'+�{�{�:�'>�D�I�I�m�$��9�9��#�-1�[�[��-B�C��r�!�s�(�|�C�G�C�'�+�+�G�S�X�X�g�5F�G�D�L�$��A�	*��L�L�/�0�&�C��c�"��)��	*��BDs�._?�<`3�?	`0�#`+�+`0)NN)r�r�r��format�format_descriptionrr�r�r�r�r�r�r�rrr�r%rrr�r�s@rXr�r�.se���
�F�%��(-�%�'��6����	7�'�R�L��*�
7�*S&�j^Hrbr�r2r3rArNrOr8r?r5r9r<r=rBrErCrP�YCbCrrSr@r7r:r>)r:r>c�V�	t|j\}}}}}}t	|��}|j
}|j}
	|d}|�d}n|dk(rd}n|dk(rd	}txs|dk7}d
|t<|jd|t<|jd
|t<d|vr|d}nCd
|vr=|d
}t|t �r*t#j$�}|j'|�|}ni}t(j+dt-|��t|t.�r|j1�}|D]t}t|t"j$�r'|t2j4vr|j7|�||<n|j|�||<	|j8||j8|<�vt=|d�rlt>t@tBtDtFtHfD]I}||jJvs�|jJ|||<|jJj8||j8|<�K|jd|jjd��}|r	||tL<tNdft@dftBdft@dftBdft>dftPdftRdftTdftVdff
D]\}}||vs�||||<�|jd�}|r!d|t><|d|t@<|d
|tB<|dk7r)||tX<t[|�d
k7rt[|�|t\<|�	||t^<|d
k7r	||t`<tb|vr
||tb<n�|jdvr�|tbdk(r�|jdk(rj|je�}|j'�}tg|jh�D]/}tg|jj�D]}|||fdk(rdnd|||f<��1|}ntmjn|�}|jd vrs|jpjsd!d"�}g}t[|�d#z}tgd#�D]0}||||z||d
zzD�cgc]}|d$z��	c}z
}|dgd$|z
zz
}�2||tt<|t|t} }t[|�||dzd%zd&zz}!tv|vr[|rG|jd'tx�}"|!dk(rd
nt{|"|!z| �}#|dk(rt{|#d%zd&zd&z| �}#n| }#|#dk(rd
}#|#|tv<|!dk(rd
n|!|tvz}$| |tvzd
z
|tvz}%|$d(k\r!t2j||j8t~<|$f|%d
z
z|!| z|$|%d
z
zz
fz|t~<t�tgd|$|%z|$��|t�<t�j|d
�|t�<|jd)k(r6t�d*t�d+ij��D]\}&}'|j�|&|'��t�t�t�t�g}(|�r�d,|vrG|d,})t|)t�r
|)dks|)d-kDr
d.}
t�|
��|dk7r
d/}
t�|
��|)|t�<t(j+d0�t(j+d1t�|j����d}*t=|d2�r5	|j�d�t�j�|j���}*i}+|(t�t~t�t�t�gz
}(tX|di},i}-t=|d3�r|j�j1�}-it�|di��|-�}.t`|.vr|.t`=t�j�|j��|.j���D]�\}&}'|&t2j�vr�t�t"j�d4d5�s�4|&|j8vr|j8|&|+|&<nGt|'tt�t�t f�s�vt3j�|&�j�}/|/r|/|+|&<|&|,vs��|&|(vs��t|'t��r|'j�d6d7�d8z|,|&<��t|'t��rt�|'�|,|&<��|'|,|&<��t`|,vr(t[|,t`�d
k(r|,t`d|,t`<t(j+d9t�|,j����|jd:vrd;}t-|,j���}0|0j��|||*||0|+f}1t#j�|jd<|1|
�}	|	j�|jpd=|jz�	|	j�d>�d
d\}2}3|*s|j�|3�|2rn�.|*r	t�j�|*�|2dkrXd?|2�d@�}
t|
��|(D]}&||&=�|j�|�}4t�j�||dd=|jz|4||!d
ffg�dA|vr||_kyy#t$r!}	d|j�d�}
t|
�|	�d}	~	wwxYw#t$r1|jjd�}t|t�rd}Y�
�"wxYw#t:$rY�	�NwxYwcc}w#t�j�$rY���wxYw#t$rY��wxYw)BNzcannot write mode z as TIFFr_r8rr"r$r*r&rr�tiffinfor#zTiffinfo Keys: %sr�r<�descriptionr:�x_resolution�y_resolution�resolution_unit�software�	date_time�artist�	copyrightr9rr0)r2r3r2�r=rBr>rrr#r%�
strip_sizerru)rr)rr��r�r�r��quality�dzInvalid quality settingz5quality setting only supported for 'jpeg' compressionzSaving using libtiff encoderz	Items: %sr'r��libtiff_support_custom_tagsFrrrdzConverted items: %s)r7r5r;r)rFi@zencoder error z when writing image file�_debug_multipage)l�	SAVE_INFOr�r�r�r��encoderinfo�
encoderconfigrr�r|r	�
WRITE_LIBTIFFrBr�rGrHr�r
�Exifr�r�r�r�r�r�rrr r�r�r�rTrRrS�IPTC_NAA_CHUNK�PHOTOSHOP_CHUNKr	r�r[�IMAGEDESCRIPTION�SOFTWARE�	DATE_TIME�ARTIST�	COPYRIGHTrKrUrMrLrJrD�copyr��height�widthr�invertr�
getpaletter\rW�
STRIP_SIZErqr�STRIPBYTECOUNTSr�r��COMPRESSION_INFO_REVr@rF�REFERENCEBLACKWHITEr��
setdefaultrXrYrV�TILEBYTECOUNTSr%�JPEGQUALITYr�r��os�dupr'�io�UnsupportedOperation�TRANSFERFUNCTION�SUBIFDr�r��	itertools�chain�LIBTIFF_COREr�r}r�r�rr#rf�sort�_getencoderr.r�r1r�r�_saver�)5rr�r�rhr`r^rs�bits�extrar4r�r�r�r�r8r)rr#r$�iccr�r9�inverted_im�pxrmrl�lut�colormap�colorsr�rrprWrq�
im_strip_size�rows_per_strip�strip_byte_counts�strips_per_imager�r�	blocklistr�r��types�atts�
legacy_ifd�
supplied_tagsrr�ro�errcoder�r�s5                                                     rXr�r�'s�
��"�6?����6H�3������e�
 �v�
.�C��.�.�K��$�$�M��!�-�0������	��	#���	��	&�*���3�{�e�3�G�!"�C����g�g�a�j�C�
�O��w�w�q�z�C����[� ��:�&��	�;�	��6�"���d�E�"��:�:�<�D��I�I�d�O��D���
�L�L�$�d�4�j�1��$�-�.��z�z�|������d�E�J�J�'�C�8�3J�3J�,J��|�|�C�(�C��H��x�x��}�C��H�	�#�|�|�C�0�C�K�K���
��r�8��
������

�
	:�C��b�i�i���9�9�S�>��C��#%�9�9�#4�#4�S�#9����C� �
	:��/�/�-������]�)C�
D�C�
���J��
�=�)�	�|�$�	�|�$�	�~�&�	�~�&�	�+�,�	�:��	�K� �	���	�K� ��
)�	��T��;��"�4�(�C��H�
)��/�/�%�
 �C�
� ��O����F��L����F��L���t�|�!��M���t�9��>�#&�t�9�C�� ���!��L��
��{�"��L��!��,�*/��&�'�	���J�	�3�'A�#B�a�#G�
�7�7�c�>��'�'�)�K��!�!�#�B��;�-�-�.�
=���{�0�0�1�=�A�$&�q�!�t�H��O�q��B�q�!�t�H�=�
=��B�����$�B�	�w�w�+���e�e���u�g�.�����S��Q����q��	-�A��#�f�q�j�6�Q��U�;K�*L�M�Q��S��M�M�H����s�V�|�,�,�H�	-�!��H�
��z�?�C��,�q�A�
��Y�1�t�A�w�;��?�q�0�
1�F��3���'�O�O�L�*�E�M�"(�A�+�Q�3�}��7N�PQ�3R�N��f�$�!$�~��'9�a�&?�1�%D�a�!H���N��Q���N�*��L��#�q�[��f�s�<�7H�.H���C��-�-��1�c�,�6G�G���E�!�'/�}�}����O�$�-�/�3C�a�3G�H���
�&�*:�Q�*>�?�?�L��C����
�a�"�%5�5�7H�I��C���,�/�/��Q�?�C���	�w�w�'���f��!=�
��%�'�	'�J�C��
�N�N�3��&�		'��J��^�D�I����#�!�)�,�G��g�s�+�w��{�g��m�/�� ��o�%��f�$�M�� ��o�%�&�C������3�4����[�&�����"5�6����2�x� �
�����
��f�f�R�Y�Y�[�)��
��	������
�	
�	��t�A�w�'���
��2�u��������J�D�7�2�x��4�C�
�C�
��=�(��l�+�#�/�/�#�)�)�+�}�7J�7J�7L�M�	&�J�C��
�(�/�/�/��u�z�z�+H�%�P���#�+�+�%�!$���S�!1�E�#�J�$�U�S�%��e�,D�E��#�?�?�3�/�4�4�D��%)��c�
��$��3�i�#7��e�S�)� %���W�i� @�5� H�D��I���{�3� %�e��D��I� %�D��I�/	&�2�4��C��\�(:�$;�q�$@�!%�l�!3�A�!6�D������*�F�4�:�:�<�,@�A��7�7�'�'��G�
�D�J�J�L�!���	�	��
�k�3��$��>�����b�g�g�y�!�]�C��	�
�
�2�5�5�&�2�7�7�*�+���H�H�Y�/���3�M�G�T���������
��
�����
��Q�;�"�7�)�+C�D�C��#�,���	�C��C��	����"��������e�V�b�g�g�-�v����7K�L�M�	
�
�[�(�!���)��A	�"�"�2�7�7�)�8�4���c�l��!��"�����g�g�k�k�-�0���k�3�'��K��	��T�	��	��RN��t�*�*�
��
��r�
��
�se�h�h/�i,�:i<�4j�j�	h,�h'�'h,�/6i)�(i)�,	i9�8i9�j�j�	j(�'j(c��eZdZgd�Zhd�Zdd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zejfd
�Zd�Zd�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zdd�Zy)�AppendingTiffWriter)rrrrrr%rrrrr%rr%rrrr%>���	� rrc� �t|d�r||_d|_n$||_d|_	t	||rdnd�|_|jj
�|_|j�y#t
$rt	|d�|_Y�LwxYw)Nr�FTzw+bzr+b)	r�r��close_fpr��openr�r��	beginning�setup)r~�fnr�s   rXr�zAppendingTiffWriter.__init__msy���2�v���D�F�!�D�M��D�I� �D�M�
)��b�3�%�E�:������������
�
����
)��b�%����
)�s�A0�0B
�B
c��|jj|jtj�d|_d|_|jjd�x|_}|sd|_	yd|_	|dk(r|jd�n$|dk(r|jd�n
d	}t|��|j�|j�y)
NrrTFr[r�rZr�zInvalid TIFF file header)r�r�r�r��SEEK_SET�whereToWriteNewIFDOffset�offsetOfNewPager��IIMM�isFirst�	setEndian�RuntimeError�skipIFDs�goToEnd)r~�iimmr�s   rXr�zAppendingTiffWriter.setup{s��������D�N�N�B�K�K�0�(,��%� ����6�6�;�;�q�>�)��	�D���D�L������=� ��N�N�3��
�]�
"��N�N�3��,�C��s�#�#��
�
�����rbc���|jry|jj|j�|jj	d�}|sy||j
k7r
d}t
|��|j�}||jz
}|jj|j�|j|�|jj|�|j�y)Nrz1IIMM of new page doesn't match IIMM of first page)r�r�r�r�r�r�r��readLongr��	writeLong�fixIFD)r~r�r��
ifd_offsets    rX�finalizezAppendingTiffWriter.finalize�s����<�<��	
�����D�(�(�)��v�v�{�{�1�~�����4�9�9��E�C��s�#�#��]�]�_�
��d�*�*�*�
������D�1�1�2����z�"������J�����
rbc�D�|j�|j�yrn)r�r�r�s rX�newFramezAppendingTiffWriter.newFrame�s���
�
���
�
�rbc��|Srnr1r�s rX�	__enter__zAppendingTiffWriter.__enter__�s���rbc�<�|jr|j�y)NF)r�r1)r~�exc_type�	exc_value�	tracebacks    rX�__exit__zAppendingTiffWriter.__exit__�s���=�=��J�J�L�rbc�P�|jj�|jz
Srn)r�r�r�r�s rXr�zAppendingTiffWriter.tell�s���v�v�{�{�}�t�3�3�3�3rbc��|tjk(r||jz
}|jj	||�|j�Srn)r�r�r�r�r�r�)r~r��whences   rXr�zAppendingTiffWriter.seek�s<���R�[�[� ��d�*�*�*�F������F�F�#��y�y�{�rbc�>�|jjdtj�|jj	�}d|dzz
}d|cxkrdkr'nn$|jjt
|��|jj	�|_y)Nrr6)r�r�r��SEEK_ENDr�r�r�r�)r~�pos�	pad_bytess   rXr�zAppendingTiffWriter.goToEnd�sj�������A�r�{�{�#��f�f�k�k�m����r��M�	��y��2���F�F�L�L��y�)�*�#�v�v�{�{�}��rbc��||_|jdz|_|jdz|_|jdz|_y)Nr3rS�HHL)�endian�longFmt�shortFmt�	tagFormat)r~r�s  rXr�zAppendingTiffWriter.setEndian�s9������{�{�S�(������c�)��
����u�,��rbc�&�	|j�}|dk(r#|jj�dz
|_y|jj	|�|j�}|jj	|dztj���)Nrrr4)r�r�r�r�r��	readShortr��SEEK_CUR)r~r��num_tagss   rXr�zAppendingTiffWriter.skipIFDs�sl�������J��Q��04�����
��0A��-���F�F�K�K�
�#��~�~�'�H��F�F�K�K��2�
�r�{�{�3�rbc�8�|jj|�Srn)r�r�ras  rXr�zAppendingTiffWriter.write�s���v�v�|�|�D�!�!rbc�|�tj|j|jj	d��\}|S)Nr)r4r5r�r�r�ris  rXr�zAppendingTiffWriter.readShort�s)���=�=���������A��?����rbc�|�tj|j|jj	d��\}|Sr])r4r5r�r�r�ris  rXr�zAppendingTiffWriter.readLong�s)���=�=����t�v�v�{�{�1�~�>����rbc��|jjdtj�|jj	tj|j|��}|�|dk7rd|�d�}t|��yy)N���r�wrote only � bytes but wanted 4�	r�r�r�r�r�r4r8r�r��r~r�
bytes_writtenr�s    rX�rewriteLastShortToLongz*AppendingTiffWriter.rewriteLastShortToLong��h�������B����$������V�[�[����u�%E�F�
��$��!�);��
��.A�B�C��s�#�#�*<�$rbc��|jjdtj�|jj	tj|j|��}|�|dk7rd|�d�}t|��yy)Nr�rr�� bytes but wanted 2)	r�r�r�r�r�r4r8r�r�r�s    rX�rewriteLastShortz$AppendingTiffWriter.rewriteLastShort�sh�������B����$������V�[�[�����%F�G�
��$��!�);��
��.A�B�C��s�#�#�*<�$rbc��|jjdtj�|jj	tj|j|��}|�|dk7rd|�d�}t|��yy)N���rr�r�r�r�s    rX�rewriteLastLongz#AppendingTiffWriter.rewriteLastLong�r�rbc��|jjtj|j|��}|�|dk7rd|�d�}t|��yy)Nrr�r)r�r�r4r8r�r�r�s    rX�
writeShortzAppendingTiffWriter.writeShort�sR�������V�[�[�����%F�G�
��$��!�);��
��.A�B�C��s�#�#�*<�$rbc��|jjtj|j|��}|�|dk7rd|�d�}t|��yy)Nrr�r�)r�r�r4r8r�r�r�s    rXr�zAppendingTiffWriter.writeLongsR�������V�[�[����u�%E�F�
��$��!�);��
��.A�B�C��s�#�#�*<�$rbc�X�|j�|jj�yrn)r�r�r1r�s rXr1zAppendingTiffWriter.close	s���
�
�������rbc�&�|j�}t|�D�]r}tj|j|j
j
d��\}}}|j|}||z}|dk}|s0|j�}	|	|jz
}	|j|	�||jvr�|j
j�}
|r9|j||dk(|dk(��|j
j|
dz�nP|j
j	�|j||dk(|dk(��|j
j|
�dx}	}
��E|s��I|j
jdtj ���uy)Nr%rr)�isShort�isLong)r�r�r4r5r�r�r��
fieldSizesr�r�r�Tagsr��
fixOffsetsr�r�r�)r~r�r�r��
field_typer��
field_size�
total_size�is_localr��cur_poss           rXr�zAppendingTiffWriter.fixIFD
sP���>�>�#���x��	,�A�%+�]�]�4�>�>�4�6�6�;�;�q�>�%R�"�C��U�����4�J�#�e�+�J�!�Q��H��������$�.�.�.���$�$�V�,��d�i�i���&�&�+�+�-����O�O��
�a��*�PQ�/�$���F�F�K�K��!��,��F�F�K�K��'��O�O��
�a��*�PQ�/�$���F�F�K�K��(�#'�'���������A�r�{�{�+�=	,rbc�.�|s|s
d}t|��t|�D]�}|r|j�n|j�}||jz
}|r�|dk\r�|dk7r
d}t|��|j|�|jjdtj�|jtj�|jjdtj���|r|j|���|j|���y)Nz offset is neither short nor longrrznot implementedi����r%)r�r�r�r�r�r�r�r�r�r�rrrrr)r~r�rrr�r�r�s       rXrzAppendingTiffWriter.fixOffsets0s����v�4�C��s�#�#��u��	-�A�)0�T�^�^�%�d�m�m�o�F��d�*�*�*�F��6�U�?��A�:�+�C�&�s�+�+��+�+�F�3������C����-�����
�
�.������A�r�{�{�+���%�%�f�-��$�$�V�,�%	-rbN)F)FF)r�r�r�r
rr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrr�r1r�rr1rbrXr�r�Os����J�(�D���2�.�
��
4�#%�+�+��-�-�	4�"���$�$�$�$�$��!,�F-rbr�c�r�|jj�}|j}t|j	dg��}t|d�s|s
t
|||�S|j�}	t|�5}|g|zD]y}||_||_t|d�sd}	n|j}	t|	�D]@}
|j|
�|j�t
|||�|j��B�{	ddd�|j|�y#1swY�xYw#|j|�wxYw)N�
append_imagesr�r)r�r�r�r�r�r�r�r�r�r�r�r�r�r�)rr�r�r�r�r�cur_idx�tf�ims�nfrrAs           rX�	_save_allrJs���.�.�%�%�'�K��$�$�M������"�=�>�M��2�z�"�=��R��X�&�&��g�g�i�G��
 ��
$�
	"���t�m�+�
"��"-���$1��!��s�J�/��C��,�,�C� ��:�"�C��H�H�S�M��H�H�J��#�r�8�,��K�K�M�	"�
"�
	"�	�����
	"�
	"��	�����s%�.D#�9BD�=D#�D �D#�#D6z.tifz.tiffz
image/tiff)n�
__future__rr�r��loggingrr�r4r&�collections.abcr�	fractionsr�numbersrr�r	r
rrr
r�_binaryrrrrrr�	getLoggerr�r�rUr��IFD_LEGACY_APIr�r�r�rGrHrKr@rDrEr�r�rMrWr�rRrSrBrTr�r�r�r��	PREDICTORr\rXrYrVr�r�rLrJ�
JPEGTABLESrFr�r�r�r�r[�EXIFIFDr	r��IMAGEJ_META_DATA_BYTE_COUNTS�IMAGEJ_META_DATAr?r�r�rPrrrNr^rarlrur�rFrfr�rAr�r�setattrr��ImageFileDirectoryr�r�r�r�r�
register_openrs�
register_save�register_save_all�register_extensions�
register_mime)�krs00rX�<module>r3s��R#�	����	�
��*��$�J�J�!�!���	��	�	�8�	$�����
���
�
�
��
���
����
��� ���	������������������������	�	���	����	�
�
�����	������
�
������	�����
�
�
��	���� %������u���|���x�	�
�x���z�
��{���v�����
�=��
�:��
���
�>��
�=��
�?�� 
�6�!�"
�6�#�$
�6�%��**:�)?�)?�)A�B���A��1��B��z
���D�!�T�2���z
���D�!�T�2���	z
�
��D�!�T�2��
�z
���D�!�T�2��
�
z
���D�!�T�2��
�z
���D�!�T�2��
�z
���D�!�T�2���z
���D�!�T�2���z
���D�!�T�2��
�z
���D�!�T�2��
�z
���D�!�T�2���z
���D�!�T�2���z
���D�!�T�2���z
� ��D�!�T�2���!z
�"��D�!�T�2��
�#z
�$��D�!�T�2��
�%z
�&��D�!�T�2��
�'z
�(��D�!�T�2��
�)z
�*��D�!�T�2���+z
�,��D�!�T�2���-z
�.��D�!�T�2���/z
�0��D�!�T�2���1z
�2��D�!�T�2��
�3z
�4��D�!�T�2��
�5z
�6��D�!�T�2���7z
�8��D�!�T�2���9z
�:��D�!�T�2��
�;z
�<��D�!�T�2��
�=z
�>��D�!�T�2��
�?z
�@��D�!�T�2��
�Az
�B��D�!�T�2��
�Cz
�D��D�!�T�2��
�Ez
�F��D�!�T�2���Gz
�H��D�!�T�2���Iz
�J��D�!�U�B��!1�Kz
�L��D�!�U�B��!1�Mz
�N��D�!�U�B��!1�Oz
�P��D�!�U�B��!3�Qz
�R��D�!�U�B��!2�Sz
�T��D�!�U�B���Uz
�V��D�!�U�B���Wz
�X��D�!�U�B���Yz
�Z��D�!�U�B���[z
�\��D�!�U�B���]z
�^��D�!�U�B���_z
�`��D�!�U�B���az
�b��D�!�U�B���cz
�d��D�!�U�B���ez
�f��D�!�V�T�"�L�gz
�h��D�!�V�T�"�L�iz
�j��D�!�Y��#�^�kz
�l��D�!�Y��#�^�mz
�n��D�!�Y��#�%5�oz
�p��D�!�Y��#�%5�qz
�r��D�!�\�2�&�(8�sz
�t��D�!�\�2�&�(8�uz
�v��D�!�\�4�(�*:�wz
�x��D�!�\�4�(�*:�yz
�z��D�!�_�f�-�/@�{z
�|��D�!�_�f�-�/@�}z
�~��D�!�'��3�5G�z
�@��D�!�'��3�5G�Az
�B��D�!�\�4�(�*:�Cz
�D��D�!�\�4�(�*:�Ez
�F��D�!�_�f�-�/@�Gz
�H��D�!�_�f�-�/@�Iz
�J��D�!�'��3�5G�Kz
�L��D�!�'��3�5G�Mz
�N��D�!�\�4�(�*:�Oz
�P��D�!�\�4�(�*:�Qz
�R��D�!�_�f�-�/@�Sz
�T��D�!�_�f�-�/@�Uz
�V��D�!�'��3�5G�Wz
�X��D�!�'��3�5G�Yz
�Z��D�!�\�6�*�,<�[z
�\��D�!�\�6�*�,<�]z
�^��D�!�\�2�&�(:�_z
�`��D�!�\�2�&�(:�az
�b��D�!�%�r�*�,@�cz
�d��D�!�%�r�*�,@�ez
�f��D�!�%�t�,�.B�gz
�h��D�!�%�t�,�.B�iz
�j��D�!�%�t�,�.B�kz
�l��D�!�%�t�,�.B�mz
�n��D�!�%�t�,�.B�oz
�p��D�!�%�t�,�.B�qz
�r��D�!�T�2���sz
�t��D�!�T�2���uz
�v��D�!�T�2��
�wz
�x��D�!�T�2��
�yz
�z��D�!�T�2���{z
�|��D�!�T�2���}z
�~��D�!�T�2��
�z
�@��D�!�T�2��
�Az
�B��D�!�T�2���Cz
�D��D�!�T�2���Ez
�F��D�!�T�2��
�Gz
�H��D�!�T�2��
�Iz
�J��D�!�T�2��
�Kz
�L��D�!�T�2��
�Mz
�N��D�!�V�T�"�L�Oz
�P��D�!�V�T�"�L�Qz
�R��D�!�T�2�����D�!�T�2�����D�!�\�2�&�(8���D�!�\�2�&�(8���D�!�_�d�+�->���D�!�_�d�+�->���D�!�'��0�2D���D�!�'��0�2D���D�!�%�r�*�,@���D�!�T�2��
���D�!�T�2��
���D�!�Y��#�_���D�!�Y��#�_���D�!�Y��#�^���D�!�Y��#�^�sz
�	�x�A�y�A�A����"�%��"����'�(�'�DG$�N�G$�T(6��$�(7��%������J�I�C���<�<��S�!�D��!�7�T�>�>�#�3F�q�3I�J��!�8�d�?�O�C�4H�I�J��O�S�$�X�1�X�x+��VH�I�'�'�VH�@
��#�r�1�a��t�	$�
��#�r�1�a��t�	$�	
�
	�4��Q��6�1�
%�
��#�r�1�a��t�	$�

�	�4��Q��6�1�
%�
��'�2�q�!�U�D�	)�
��V�R��A�u�d�+�
��g�r�1�a���
-�
��'�2�q�!�U�D�	)�
�
�E�2�q�!�Y��-�
��V�R��A�|�Q�/�
��V�R��A�|�Q�/�
��V�R��A�|�T�2�
� �g�r�1�a��D�
1�!
�"
�E�2�q�!�Y��-�#
�$
�x��Q��5�$�/�%
�&�g�r�1�a���
-�'
�(��Q��5�$�/���Q��5�$�/�+
�	�2e"�P	x-�x-�v�>����M�(�(�-��A�����M�(�(�%�0�����
�,�,�i�8�����-�.�.���0A�B�����M�(�(�,�7��G?Cs�
]

Zerion Mini Shell 1.0