%PDF- %PDF-
Mini Shell

Mini Shell

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

�

��e8,���ddlmZddlmZddlmZmZ	ddlmZdZdddd�Z
ddd	�Zd
ddd�Zd
�Z
Gd�dej�Zd�Zd�Zej"ej$ee
�er�ej&ej$e�ej(rej*ej$e�ej,ej$d�ej.ej$d�yy#e	$rdZY��wxYw)�)�annotations)�BytesIO�)�Image�	ImageFile)�_webpTF)�RGBX�RGBA�RGB)rr
rr
)sVP8 sVP8XsVP8Lc�\�|dddk(}|dddk(}|ddtv}|r|r|r	ts	yyyyy)	N�sRIFF��sWEBP�zEimage file could not be identified because WEBP support not installedT)�_VP8_MODES_BY_IDENTIFIER�	SUPPORTED)�prefix�is_riff_file_format�is_webp_file�is_valid_vp8_modes    �5/usr/lib/python3/dist-packages/PIL/WebPImagePlugin.py�_acceptrsX�� ��!�*��/���!�B�<�7�*�L��r�"�
�)A�A���|�0A��W�
��1B�|��c�j��eZdZdZdZdZdZd�Zd�Zd�Z	d�Z
dd�Zd	�Zd
�Z
�fd�Zd�Z�fd
�Z�xZS)�
WebPImageFile�WEBPz
WebP imagerc�F�tjs�tj|jj	��\}}}|_}}|r||jd<|r||jd<||f|_t|�|_dd|jzd|jfg|_d|_d|_
ytj|jj	��|_|jj!�\}}}}}}	||f|_||jd<|d	z	d
z|dz	d
z|dz	d
z|d
zf\}
}}}
|||
|
f|jd
<||_|jdkD|_
|	dk(rdn|	|_|	|_g|_|jj%d�}|jj%d�}|jj%d�}|r||jd<|r||jd<|r||jd<|j'd��y)N�icc_profile�exif�raw�rrrrF�loop��rr�
backgroundr	r�ICCP�EXIFzXMP �xmp)�reset)r�
HAVE_WEBPANIM�
WebPDecode�fp�read�_mode�info�_sizer�size�mode�tile�n_frames�is_animated�WebPAnimDecoder�_decoder�get_info�rawmode�	get_chunk�_reset)�self�data�width�heightrr�
loop_count�bgcolor�frame_countr2�bg_a�bg_r�bg_g�bg_br(s               r�_openzWebPImageFile._open-s���"�"�AF�AQ�AQ�������B�>�D�%����[�$��+6��	�	�-�(��$(��	�	�&�!����D�J��d�m�D�G���$�)�)�!3�Q��	�	�B�C�D�I��D�M�$�D����-�-�d�g�g�l�l�n�=��
�AE�
�
�@V�@V�@X�=��v�z�7�K���F�]��
�&��	�	�&��
��]�d�"�
��]�d�"�
��\�T�!��d�N�	"
���d�D�$�$(��t�T�":��	�	�,��#��
��=�=�1�,���"�f�n�U�$��
������	��m�m�-�-�f�5���}�}�&�&�v�.���m�m�%�%�f�-���'2�D�I�I�m�$�� $�D�I�I�f���"�D�I�I�e��	
���%�� rc�\�d|jvry|j�j�S)Nr)r/�getexif�_get_merged_dict�r<s r�_getexifzWebPImageFile._getexifas&������"���|�|�~�.�.�0�0rc�^�d|jvr|j|jd�SiS)z�
        Returns a dictionary containing the XMP tags.
        Requires defusedxml to be installed.

        :returns: XMP tags in a dictionary.
        r()r/�_getxmprKs r�getxmpzWebPImageFile.getxmpfs,��27�$�)�)�1C�t�|�|�D�I�I�e�,�-�K��Krc�6�|j|�sy||_y�N)�_seek_check�_WebPImageFile__logical_frame�r<�frames  r�seekzWebPImageFile.seekos������&�� %��rc�f�|r|jj�d|_d|_d|_y)Nr���)r7r)�_WebPImageFile__physical_frame�_WebPImageFile__loaded�_WebPImageFile__timestamp)r<r)s  rr;zWebPImageFile._resetvs,����M�M���!� !�����
���rc�
�|jj�}|xjdz
c_|�.|j�|j	d�d}t|��|\}}||jz
}||_||z}|||fS)Nrrz(failed to decode next frame in WebP file)r7�get_nextrYr;rV�EOFErrorr[)r<�ret�msgr=�	timestamp�durations      r�	_get_nextzWebPImageFile._get_next}s����m�m�$�$�&������"���;��K�K�M��I�I�a�L�<�C��3�-�����i��t�/�/�/��$���	�X��	��Y��(�(rc���|j|k(ry||jkr|j�|j|kr!|j�|j|kr� yyrQ)rYr;rcrTs  r�_seekzWebPImageFile._seek�sR��� � �E�)���4�(�(�(��K�K�M��#�#�e�+��N�N���#�#�e�+rc���tjr�|j|jk7r�|j	|j�|j�\}}}||jd<||jd<|j|_|jr&|jr|jj�t|�|_dd|jzd|jfg|_
t�|�=�S)Nrarbr r!r)rr*rZrSrercr/r,�
_exclusive_fp�closerr1r9r3�super�load)r<r=rarb�	__class__s    �rrjzWebPImageFile.load�s��������}�}�� 4� 4�4��
�
�4�/�/�0�-1�N�N�,<�)��i��)2��	�	�+�&�(0��	�	�*�%� $� 4� 4��
��7�7�t�1�1��G�G�M�M�O�!�$�-���#�V�d�i�i�%7��D�L�L�I�J��	��w�|�~�rc��yrQ�)r<�poss  r�	load_seekzWebPImageFile.load_seek�s��rc�X��tjst�|�
�S|jSrQ)rr*ri�tellrS)r<rks �rrqzWebPImageFile.tell�s$����"�"��7�<�>�!��#�#�#r)T)�__name__�
__module__�__qualname__�format�format_descriptionrZrSrGrLrOrVr;rcrerjrorq�
__classcell__)rks@rrr'sQ���
�F�%���H��O�2!�h1�
L�%��)�*��&
�$�$rrc��	�|jj�}t|jdg��}d}|g|zD]}|t	|dd�z
}�|dk(rt|||�yd}d|vr|d}n^d|jvrP|jd}t|t�r1|j�}|r||dz|dzdz\}	}
}|	|
|df}n|||df}|jjd	|jjd	d��}|jjd
d�}
|jjdd�}|jjd
d�}|jjdd�}|jjdd�}d}|jjdd�}|jjdd�}|jjdd�}|jjd�xsd}|jjdd�}t|tj�r|j�}|jjdd�}|rd}|�|rdnd}|�|rdnd}t|ttf�r t|�dk7std�|D��sd|��}t!|��|\}}}}|dz|dzz|d zz|dzz}t#j$|j&d|j&d||
|||||�	}d}d} |j)�}!	|g|zD�]B}t	|dd�}"t+|"�D�]#}#|j-|#�|j/�|}$|j0}%|j0t2vrdd!|j0vxs=d"|j0vxs-|j0d#k(xrd!|j4j7�v}&|&rd$nd%}%|j9|%�}$|%d%k(rd&}%|j;|$jd'|%�t=| �|$j&d|$j&d|%|||�t|ttf�r	| ||z
} n| |z
} |dz
}��&��E	|j-|!�|j;dt=| �ddd||d�|j?|||�}'|'�
d(}t!|��|jA|'�y#|j-|!�wxYw))N�
append_imagesrr4r)rrrrr%�r$rbr"�
minimize_sizeF�kmin�kmax�allow_mixed�lossless�quality�P�methodr�rr(�	��r
c3�<K�|]}d|cxkxrdknc���y�w)r�Nrm)�.0�vs  r�	<genexpr>z_save_all.<locals>.<genexpr>�s����4�A�1��<�C�<�<�4�s�z:Background color is not an RGBA tuple clamped to (0-255): r#rr�A�a�Pr
rr	r �1cannot write file as WebP (encoder returned None))!�encoderinfo�copy�list�get�getattr�_saver/�
isinstance�int�
getpaletter�Exif�tobytes�tuple�len�all�OSErrorr�WebPAnimEncoderr1rq�rangerVrjr2�_VALID_WEBP_MODES�im�getpalettemode�convert�add�round�assemble�write)(r�r,�filenamer�ry�total�imsr%�palette�r�g�brbr"r{r|r}r~�verboserr�r�rrr(r`rDrErFrC�enc�	frame_idxra�cur_idx�nfr�idxrUr9�alphar=s(                                        r�	_save_allr��s����.�.�%�%�'�K������"�=�>�M�
�E��t�m�#�-��
���j�!�,�,��-���z�
�b�"�h����J��{�"� ��.�
�	����	 ��W�W�\�*�
��j�#�&��m�m�o�G��!�*�q�.�J��N�a�3G�H���1�a���A�s�^�
�(�*�j�#�F�
��~�~�!�!�*�b�g�g�k�k�*�a�.H�I�H�
�>�>���f�a�(�D��N�N�&�&���>�M�
�>�>���f�d�+�D�
�>�>���f�d�+�D��.�.�$�$�]�E�:�K��G��~�~�!�!�*�e�4�H��n�n� � ��B�/�G�
�^�^�
�
��!�
,�F��.�.�$�$�]�3�9�r�K�
�>�>���f�b�)�D��$��
�
�#��|�|�~��
�.�.�
�
�U�B�
'�C�����|��q�!���|��r�1��
�z�D�%�=�1��z�?�a���4��4�4�J�:�,�W���c�l��(��D�$��d��"�*����,���	�:�d�a�i�H�J��
�
�
����
�
����
��������
�C��I��I��g�g�i�G�-��4�-�'�)	�C��#�z�1�-�C��S�z�%
������
����
����(�(���8�8�#4�4��s�x�x��P��#�(�(�?�P��H�H��O�N��s�v�v�7L�7L�7N�0N��
).�f�5�G��K�K��0�E��e�#�$�G�����M�M�%��1��)�$��J�J�q�M��J�J�q�M�����	��h��u�
�6���)�!4�4�I���)�I��Q��	�K%
�	)	�X	������G�G�D�%�	�"�A�q�"�h���C��<�<��T�3�/�D��|�A���c�l���H�H�T�N��	�����s
�-ES � S3c
�n�|jjdd�}|jjdd�}|jjd�xsd}|jjdd�}t|tj�r|j�}|j
d	�r|d
d}|jjdd�}|jjdd
�}|jjd�rdnd}	|jtvr|j|jrdnd�}tj|j�|jd|jd|t|�|j|||	||�}
|
�
d}t|��|j!|
�y)NrFr�r�rr�rrsExif�r(r�r
�exactrrr
rr�)r�r�r�rr�r��
startswithr2�_VALID_WEBP_LEGACY_MODESr��has_transparency_datar�
WebPEncoder1�floatr�r�)r�r,r�rr�rrr(r�r�r=r`s            rr�r�Dsf���~�~�!�!�*�e�4�H��n�n� � ��B�/�G��.�.�$�$�]�3�9�r�K�
�>�>���f�c�*�D��$��
�
�#��|�|�~������'��A�B�x��
�.�.�
�
�U�B�
'�C�
�^�^�
�
��!�
,�F����#�#�G�,�A�!�E�	�w�w�.�.�
�Z�Z�"�":�":���
F�����
�
�
��
����
�
����
��
�g��
�����
����D��|�A���c�l���H�H�T�Nrz.webpz
image/webpN)�
__future__r�iorr�rrrr�ImportErrorr�r�rrrr�r��
register_openru�
register_saver*�register_save_all�register_extension�
register_mimermrr�<module>r�s��"������I�
"�4��=��#'��6���
�
���
�M$�I�'�'�M$�`J�Z!�H����M�(�(�-��A���E���
�,�,�e�4��������
� 4� 4�i�@��E���]�1�1�7�;��E���
�,�,�l�;�
��}
���I��s�C/�/C9�8C9

Zerion Mini Shell 1.0