403Webshell
Server IP : 54.37.205.81  /  Your IP : 216.73.216.76
Web Server : nginx/1.22.1
System : Linux vps-249481fa 6.1.0-50-cloud-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.176-1 (2026-07-02) x86_64
User : debian ( 1000)
PHP Version : 8.2.32
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /lib/python3/dist-packages/PIL/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/python3/dist-packages/PIL/__pycache__/BlpImagePlugin.cpython-311.pyc
�

�"�c{>���dZddlZddlZddlmZddlmZddlmZm	Z	ddl
mZGd�d	e��ZGd
�de��Z
Gd�d
e��Zd�Zd�Zd&d�Zd�Zd�ZGd�de��Zd�ZGd�de	j	��ZGd�de	j��ZGd�de��ZGd�de��ZGd�d e	j��Zd&d!�Zejej ee��ej!ej d"��ej"d#e��ej"d$e��ej#ej e��ej$d%e��dS)'a�
Blizzard Mipmap Format (.blp)
Jerome Leclanche <jerome@leclan.ch>

The contents of this file are hereby released in the public domain (CC0)
Full text of the CC0 license:
  https://creativecommons.org/publicdomain/zero/1.0/

BLP1 files, used mostly in Warcraft III, are not fully supported.
All types of BLP2 files used in World of Warcraft are supported.

The BLP file structure consists of a header, up to 16 mipmaps of the
texture

Texture sizes must be powers of two, though the two dimensions do
not have to be equal; 512x256 is valid, but 512x200 is not.
The first mipmap (mipmap #0) is the full size image; each subsequent
mipmap halves both dimensions. The final mipmap should be 1x1.

BLP files come in many different flavours:
* JPEG-compressed (type == 0) - only supported for BLP1.
* RAW images (type == 1, encoding == 1). Each mipmap is stored as an
  array of 8-bit values, one per pixel, left to right, top to bottom.
  Each value is an index to the palette.
* DXT-compressed (type == 1, encoding == 2):
- DXT1 compression is used if alpha_encoding == 0.
  - An additional alpha bit is used if alpha_depth == 1.
  - DXT3 compression is used if alpha_encoding == 1.
  - DXT5 compression is used if alpha_encoding == 7.
�N)�IntEnum)�BytesIO�)�Image�	ImageFile)�	deprecatec��eZdZdZdS)�FormatrN)�__name__�
__module__�__qualname__�JPEG���4/usr/lib/python3/dist-packages/PIL/BlpImagePlugin.pyr
r
)s�������D�D�Drr
c��eZdZdZdZdZdS)�Encodingr��N)rrr
�UNCOMPRESSED�DXT�UNCOMPRESSED_RAW_BGRArrrrr-s �������L�
�C����rrc��eZdZdZdZdZdS)�
AlphaEncodingrr�N)rrr
�DXT1�DXT3�DXT5rrrrr3s�������D��D��D�D�Drrc�V�tdtdtdi���D]c\}}|�|��rI|t|��d�}||jvr)t|�|��d|j�d|����||cS�ddt�d|�d�}t|���)	N�BLP_FORMAT_�
BLP_ENCODING_�BLP_ALPHA_ENCODING_�
�.zmodule 'z' has no attribute '�')
r
rr�items�
startswith�len�__members__rr�AttributeError)�name�enum�prefix�msgs    r�__getattr__r/9s����
��/��,���e�g�g�		"�	"���f�
�?�?�6�"�"�	"���F���
�
�&�D��t�'�'�'��V�+�T�+�+�R�D�M�1J�1J�D�1J�1J�K�K�K��D�z�!�!�!��
:�X�
:�
:�4�
:�
:�
:�C�
��
�
�rc�<�|dz	dzdz|dz	dzdz|dzdzfS)N��r��?rr)�is r�
unpack_565r6Hs2��
�"�W����"�a�1�f��_��$:�Q��X�!�O�K�KrFc	�T�t|��dz}t��t��t��t��f}t|��D�]N}|dz}tjd||��\}}}t|��\}	}
}t|��\}}
}td��D]�}td��D]�}|dz}|dz	}d}|dkr|	|
|}}}n�|dkr||
|}}}n||dkrA||kr"d|	z|zdz}d|
z|
zdz}d|z|zdz}nN|	|zdz}|
|
zdz}||zdz}n5|dkr/||kr"d|z|	zdz}d|
z|
zdz}d|z|zdz}nd	\}}}}|r ||�||||g����||�|||g������P|S)
�E
    input: one "row" of data (i.e. will produce 4*width pixels)
    �z<HHI�rr�rr)rrrr�r(�	bytearray�range�struct�unpack_fromr6�extend)�data�alpha�blocks�ret�block�idx�color0�color1�bits�r0�g0�b0�r1�g1�b1�jr5�control�a�r�g�bs                      r�decode_dxt1rWLs)��
��Y�Y�!�^�F��;�;�	���Y�[�[�)�+�+�
>�C��v���*-�*-���a�i��%�1�&�$��D�D�������'�'�
��B����'�'�
��B���q��� 	-� 	-�A��1�X�X�
-�
-����(���q�y�����a�<�<� �"�b�!�q�A�A���\�\� �"�b�!�q�A�A���\�\�������V�b�[�Q�.����V�b�[�Q�.����V�b�[�Q�.����"�W��N���"�W��N���"�W��N�����\�\�������V�b�[�Q�.����V�b�[�Q�.����V�b�[�Q�.���%/�
��1�a���-���F�M�M�1�a��A�,�/�/�/�/���F�M�M�1�a��)�,�,�,�,�?
-� 	-�D�Jrc	��t|��dz}t��t��t��t��f}t|��D�]i}|dz}|||dz�}tjd|��}tjd|d��\}}tjd|d��\}t|��\}	}
}t|��\}}
}td��D]�}d}td��D]�}d|z|zd	z}||}|rd}|dz}nd
}|dz}|dz}|d	d|z|zzz	d
z}|dkr|	|
|}}}n\|dkr||
|}}}nO|d	kr"d	|	z|zd
z}d	|
z|
zd
z}d	|z|zd
z}n'|d
kr!d	|z|	zd
z}d	|
z|
zd
z}d	|z|zd
z}||�||||g���Ōِ�k|S)r8�z<8B�<HHr9�<I�r:FrT��rrrr<)rBrDrErFrGrJrHrI�coderKrLrMrNrOrPrQ�highr5�alphacode_indexrS�
color_coderTrUrVs                        r�decode_dxt3rc�s>��
��Y�Y�"�_�F��;�;�	���Y�[�[�)�+�+�
>�C��v���(,�(,���b�j���S�3��8�^�$���!�%��/�/���+�E�5�!�<�<�����$�T�5�"�5�5�����'�'�
��B����'�'�
��B���q���	,�	,�A��D��1�X�X�
,�
,��#$�q�5�1�9��"2����)���� �D��!�G�A�A��D���H�A��R���"�a�1�q�5�1�9�o�5��=�
���?�?� �"�b�!�q�A�A��1�_�_� �"�b�!�q�A�A��1�_�_��R��"���*�A��R��"���*�A��R��"���*�A�A��1�_�_��R��"���*�A��R��"���*�A��R��"���*�A��A��
�
�q�!�Q��l�+�+�+�+�5
,�	,�<�Jrc	��t|��dz}t��t��t��t��f}t|��D�](}|dz}|||dz�}tjd|��\}}tjd|d��}|d|ddzz|ddzz|dd	zz}|d
|ddzz}	tjd|d��\}
}tjd
|d��\}t|
��\}
}}t|��\}}}td��D�]=}td��D�])}dd|z|zz}|dkr	|	|z	dz}n |dkr|	dz	|dzdzz}n||dz
z	dz}|d
kr|}nJ|dkr|}nA||krd|z
|z|dz
|zzdz}n&|dkrd
}n|dkrd}nd|z
|z|dz
|zzdz}|dd|z|zzz	dz}|d
kr|
||}}}n\|dkr|||}}}nO|dkr"d|
z|zdz}d|z|zdz}d|z|zdz}n'|dkr!d|z|
zdz}d|z|zdz}d|z|zdz}||�||||g����+��?��*|S)zG
    input: one "row" of data (i.e. will produce 4 * width pixels)
    rYz<BBz<6Brrr9r:r3�rrrZr[r\rr]�r;r<)rBrDrErFrG�a0�a1rJ�
alphacode1�
alphacode2rHrIr_rKrLrMrNrOrPrQr5ra�	alphacoderSrbrTrUrVs                            r�decode_dxt5rl�sA��
��Y�Y�"�_�F��;�;�	���Y�[�[�)�+�+�
>�C��v���9,�9,���b�j���S�3��8�^�$���#�E�5�1�1���B��!�%���2�2���!�W��Q��1��-��a��B��?�4��7�b�=�Q�
��!�W��Q��1��-�
��+�E�5�!�<�<�����$�T�5�"�5�5�����'�'�
��B����'�'�
��B���q���(	,�(	,�A��1�X�X�'
,�'
,��"#�q�1�u�q�y�/��"�b�(�(�!+��!>�$� F�I�I�$��*�*�!+�r�!1�z�Q��$�6N� O�I�I�!+��"�0D�!E�� M�I���>�>��A�A��!�^�^��A�A��"�W�W��i�-�2�-��Q��"�0D�D��J�A�A��!�^�^��A�A��!�^�^��A�A��i�-�2�-��Q��"�0D�D��J�A�"�a�1�q�5�1�9�o�5��=�
���?�?� �"�b�!�q�A�A��1�_�_� �"�b�!�q�A�A��1�_�_��R��"���*�A��R��"���*�A��R��"���*�A�A��1�_�_��R��"���*�A��R��"���*�A��R��"���*�A��A��
�
�q�!�Q��l�+�+�+�+�O'
,�(	,�T�Jrc��eZdZdS)�BLPFormatErrorN)rrr
rrrrnrn�s�������Drrnc��|dd�dvS)Nr:��BLP1�BLP2r)r-s r�_acceptrss���"�1�"�:�+�+�+rc� �eZdZdZdZdZd�ZdS)�BlpImageFilez 
    Blizzard Mipmap Format
    �BLPzBlizzard Mipmap Formatc��|j�d��|_|j�dtj��t
jd|j�d����\|_|j�dtj��t
jd|j�d����|_	|jdvr|j�
��}n&d	t|j����}t|���|jrd
nd|_
|d|jzd
|j
d
dffg|_dS)Nr:r3�<brr�<IIr9rpzBad BLP magic �RGBA�RGB�rrr)�fp�read�magic�seek�os�SEEK_CURr?�unpack�_blp_alpha_depth�_size�decode�reprrn�mode�size�tile)�self�decoderr.s   r�_openzBlpImageFile._opens	���W�\�\�!�_�_��
�����Q���$�$�$�#)�=��t�w�|�|�A���#G�#G� ��	�����Q���$�$�$��]�5�$�'�,�,�q�/�/�:�:��
��:�+�+�+��j�'�'�)�)�G�G�5�4��
�#3�#3�5�5�C� ��%�%�%�"�3�>�F�F���	��v��	�1�1�t�y�!�Q�6G�H�I��	�	�	rN)rrr
�__doc__�format�format_descriptionr�rrrrurus?���������F�1��J�J�J�J�Jrruc�0�eZdZdZd�Zd�Zd�Zd�Zd�ZdS)�_BLPBaseDecoderTc��	|���|���n)#tj$r}d}t	|��|�d}~wwxYwdS)NzTruncated BLP file)���r)�_read_blp_header�_loadr?�error�OSError)r��buffer�er.s    rr�z_BLPBaseDecoder.decode$sc��	&��!�!�#�#�#��J�J�L�L�L�L���|�	&�	&�	&�&�C��#�,�,�A�%�����	&�����us�(+�A�A�Ac���|j�d��tjd|�d����\|_tjd|�d����\|_tjd|�d����\|_tjd|�d����\|_|j�dtj
��tjd|�d����|_t|t��rTtjd|�d����\|_|j�dtj
��tjd|�d����|_tjd|�d����|_dS)	Nr:�<irxrryr9�<16I�@)�fdr�r?r��
_safe_read�_blp_compression�
_blp_encodingr��_blp_alpha_encodingr�r�r��
isinstance�BLP1Decoder�_blp_offsets�_blp_lengths)r�s rr�z _BLPBaseDecoder._read_blp_header-si������Q����#)�=��t���q�7I�7I�#J�#J� ��	� &�
�d�D�O�O�A�4F�4F� G� G���	�#)�=��t���q�7I�7I�#J�#J� ��	�&,�m�D�$�/�/�!�:L�:L�&M�&M�#��	!�����Q���$�$�$��M�%�����);�);�<�<��	��d�K�(�(�	)�$*�M�$�����8J�8J�$K�$K�!�T�
��G�L�L��B�K�(�(�(�"�M�&�$�/�/�&�2I�2I�J�J���"�M�&�$�/�/�&�2I�2I�J�J����rc�6�tj|j|��S)N)rr�r�)r��lengths  rr�z_BLPBaseDecoder._safe_read@s���#�D�G�V�4�4�4rc���g}td��D]`}	tjd|�d����\}}}}n#tj$rYnwxYw|�||||f���a|S)N��<4Br:)r>r?r�r�r��append)r�rEr5rVrUrTrSs       r�
_read_palettez_BLPBaseDecoder._read_paletteCs������s���	%�	%�A�
�#�]�5�$�/�/�!�2D�2D�E�E�
��1�a�����<�
�
�
����
�����J�J��1�a��|�$�$�$�$��
s�-A�A�Ac�j�t��}t|�|jd����}		t	jd|�d����\}n#tj$rYn9wxYw||\}}}}|||f}	|jr|	|fz
}	|�	|	���v|S)NrT�<Br)
r=rr�r�r?r�r~r�r�rA)
r��paletterB�_data�offsetrVrUrTrS�ds
          r�
_read_bgraz_BLPBaseDecoder._read_bgraMs����{�{�������(9�!�(<�=�=�>�>��		�
�"�M�$��
�
�1�
�
�>�>�	�����<�
�
�
���
���� ���J�A�q�!�Q��A�q�	�A��$�
��a�T�	���K�K��N�N�N�		��s�*A)�)A;�:A;N)	rrr
�	_pulls_fdr�r�r�r�r�rrrr�r�!sg�������I����K�K�K�&5�5�5����
�
�
�
�
rr�c��eZdZd�Zd�ZdS)r�c��|jtjkr|���dS|jdkr||jdvrM|���}|�|��}|�t|����dSdt|j����}t|���dt|j����}t|���)Nr)r:r3zUnsupported BLP encoding zUnsupported BLP compression )r�r
r�_decode_jpeg_streamr�r�r��
set_as_raw�bytesr�rn)r�r�rBr.s    rr�zBLP1Decoder._load^s���� �F�K�/�/��$�$�&�&�&�&�&�
�
"�a�
'�
'��!�V�+�+��,�,�.�.�����w�/�/������d���,�,�,�,�,�L�$�t�7I�2J�2J�L�L��$�S�)�)�)�K��d�6H�1I�1I�K�K�C� ��%�%�%rc���ddlm}tjd|�d����\}|�|��}|�|jd|j���z
��|�|jd��}||z}t|��}||��}tj|j��|j
dkr&|jd\}}}}	||||	ddffg|_|�d�����\}
}}tjd|||
f��}|�|�����dS)Nr)�
JpegImageFiler[r:r�CMYKr{)�JpegImagePluginr�r?r�r�r�r��tellr�rr�_decompression_bomb_checkr�r�r��convert�split�merger��tobytes)
r�r��jpeg_header_size�jpeg_headerrB�image�decoder_name�extentsr��argsrTrUrVs
             rr�zBLP1Decoder._decode_jpeg_streamnsW��2�2�2�2�2�2�$�m�D�$�/�/�!�2D�2D�E�E��	��o�o�&6�7�7������)�!�,�t�w�|�|�~�~�=�>�>�>����t�0��3�4�4���T�!���t�}�}���
�d�#�#��
�'��
�3�3�3��:����27�*�Q�-�/�L�'�6�4�'��&�4��7�F�:K�L�M�E�J��-�-��&�&�,�,�.�.���1�a���E�A�q�!�9�-�-������
�
���(�(�(�(�(rN)rrr
r�r�rrrr�r�]s2������&�&�&� )�)�)�)�)rr�c��eZdZd�ZdS)�BLP2Decoderc�X�|���}|j�|jd��|jdk�r|jtjkr|�|��}�n|jtj	k�r�t��}|jtj
kry|jddzdzdz}t|jddzdz��D]@}t!|�|��t%|j�����D]}||z
}��A�nd|jtjkrd|jddzdzdz}t|jddzdz��D],}t+|�|����D]}||z
}��-n�|jtjkrd|jddzdzdz}t|jddzdz��D],}t/|�|����D]}||z
}��-nrdt1|j����}t3|���d	t1|j����}t3|���d
t1|j����}t3|���|�t7|����dS)Nrrrr:r9)rCrYzUnsupported alpha encoding zUnknown BLP encoding zUnknown BLP compression )r�r�r�r�r�r�rrr�rr=r�rrr�r>rWr��boolr�rrcrrlr�rnr�r�)r�r�rB�linesize�ybr�r.s       rr�zBLP2Decoder._load�s����$�$�&�&������T�&�q�)�*�*�*�� �A�%�%��!�X�%:�:�:����w�/�/����#�x�|�3�3� �{�{���+�}�/A�A�A� $�	�!��q� 0�Q�6��:�H�#�T�Y�q�\�A�%5�!�$;�<�<�&�&��!,� �O�O�H�5�5�T�$�BW�=X�=X�"�"�"�&�&�A�!�A�I�D�D�&�&��-��1C�C�C� $�	�!��q� 0�Q�6��;�H�#�T�Y�q�\�A�%5�!�$;�<�<�&�&��!,�T�_�_�X�-F�-F�!G�!G�&�&�A� �A�I�D�D�&�&��-��1C�C�C� $�	�!��q� 0�Q�6��;�H�#�T�Y�q�\�A�%5�!�$;�<�<�&�&��!,�T�_�_�X�-F�-F�!G�!G�&�&�A� �A�I�D�D�&�&�Y��T�=U�8V�8V�X�X�C�(��-�-�-�H�d�4�3E�.F�.F�H�H��$�S�)�)�)�K�T�$�2G�-H�-H�J�J�C� ��%�%�%�����d���$�$�$�$�$rN)rrr
r�rrrr�r��s#������+%�+%�+%�+%�+%rr�c��eZdZdZd�Zd�ZdS)�
BLPEncoderTc	���d}|j�dd��}td��D]5}||dz|dzdz�\}}}}|tjd||||��z
}�6|S)Nrrzr�r:rr�)�im�
getpaletter>r?�pack)r�rBr�r5rTrUrVrSs        r�_write_palettezBLPEncoder._write_palette�sy�����'�$�$�V�V�4�4���s���	3�	3�A� ��Q��!�a�%�1��!4�5�J�A�q�!�Q��F�K��q�!�Q��2�2�2�D�D��rc
��|���}dt|��z}tjd|gd�R�}|jj\}}|tjd||zgd�R�z
}||z
}t
|��D]F}t
|��D]4}|tjd|j�||f����z
}�5�Gt|��d|fS)N�r�)rrrrrrrrrrrrrrrr�r)r�r(r?r�r�r�r>�getpixel)	r��bufsize�palette_datar�rB�w�h�y�xs	         r�encodezBLPEncoder.encode�s����*�*�,�,�� �3�|�#4�#4�4���{�6�6�8�Y�8�8�8���w�|���1����F�A��E�8�Y�8�8�8�8�������q���	D�	D�A��1�X�X�
D�
D�����D�$�'�*:�*:�A�q�6�*B�*B�C�C�C���
D��4�y�y�!�T�!�!rN)rrr
�
_pushes_fdr�r�rrrr�r��s7�������J����"�"�"�"�"rr�c���|jdkrd}t|���|j�d��dkrdnd}|�|��|�tjdd����|�tjd	tj����|�tjd	|j	jd
krdnd����|�tjd	d����|�tjd	d����|�tjdg|j
�R���|dkrP|�tjdd
����|�tjdd����tj||dd|j
zd|jfg��dS)N�PzUnsupported BLP image mode�blp_version�BLP1rqrrr�rrxrzrryr3rvr|)
r��
ValueError�encoderinfo�get�writer?r�rrr�r�r�_save)r�r}�filename�save_allr.rs      rr�r��s���	�w�#�~�~�*����o�o���~�)�)�-�8�8�F�B�B�G�G��E��H�H�U�O�O�O��H�H�V�[��q�
!�
!�"�"�"��H�H�V�[��x�4�
5�
5�6�6�6��H�H�V�[��B�J�O�v�$=�$=�q�q�1�
E�
E�F�F�F��H�H�V�[��q�
!�
!�"�"�"��H�H�V�[��q�
!�
!�"�"�"��H�H�V�[��
)���
)�
)�
)�*�*�*�����
�����T�1�%�%�&�&�&�
�����T�1�%�%�&�&�&�
�O�B��e�V�b�g�%5�q�"�'�B�C�D�D�D�D�Drz.blpr��BLP2rv)F)%r�r�r?r,r�ior�rr�
_deprecaterr
rrr/r6rWrcrl�NotImplementedErrorrnrsru�	PyDecoderr�r�r��	PyEncoderr�r��
register_openr��register_extension�register_decoder�
register_save�register_encoderrrr�<module>r�s����>
�	�	�	�
�
�
�
���������������������!�!�!�!�!�!�
�
�
�
�
�W�
�
�
������w����
�
�
�
�
�G�
�
�
����L�L�L�4�4�4�4�n2�2�2�jC�C�C�L	�	�	�	�	�(�	�	�	�,�,�,�J�J�J�J�J�9�&�J�J�J�69�9�9�9�9�i�)�9�9�9�x!)�!)�!)�!)�!)�/�!)�!)�!)�H,%�,%�,%�,%�,%�/�,%�,%�,%�^"�"�"�"�"��$�"�"�"�:E�E�E�E�*���L�'��w�?�?�?�����,�f�5�5�5����v�{�+�+�+����v�{�+�+�+����L�'��/�/�/����u�j�)�)�)�)�)r

Youez - 2016 - github.com/yon3zu
LinuXploit