Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
IcoImagePlugin.cpython-313.pyc105 linesDownload Raw Back to __pycache__
1�

2v�j�4����SSKJr SSKrSSKJr SSKJrJr SSKJ	r	J3r4 SSKJrJ
r
JrJr SSKJr SS	KJr SS5KJr SSKJr SSKJr S
rSSjrSSjr"SS\65r"SS5r"SS\R5r\
R@"\RB\\5 \
RD"\RB\5 \
RF"\RBS5 \
RH"\RBS5 g)�)�annotationsN)�BytesIO)�ceil�log)�IO�7NamedTuple�)�BmpImagePlugin�Image�	ImageFile�PngImagePlugin)�i16le)�i32le)�o8)�o16le)�o32lesc�v�UR[5 URRS5S:HnURRS/SQ5n/nU/URRS/5-nURupx[[
U55GH/n	U	SU:�dU	SU:�dU	SS:�d	U	SS:�aM*UH�n8U9RU	:waMURU105 U(a�[RU11RSnU/nUH^n
U
RU	:waM[RU
RSnX�;dM<URU
5 URU5 M`  M� W12R5nURU	[RRSS	9 URU5 GM2 UR[![#U555 UR%5[#U5S13--nUGH'nURupxUR['US:aUOS55 UR['US:aUOS55 U(a [RURSSOSunnUR['U55 URS5 URS
5 UR[!U55 [)5nU(acUR+US5 US:waJ[R,"SW	5n[.R0"UU[.R2"SSU	-SS5/5 OUR+US5 UR5S5 UR75nU(aUSS[9US-5-USS-n[#U5nUR[9U55 UR[9U55 UR%5nUR5U5 URU5 UU-nUR5U5 GM* g)N�
bitmap_format�bmp�sizes))�r)�r)� r)�0r)�@r)�r)�r�
append_imagesrr	r)�reducing_gapr)rr�s�dibr�1�raw�rr)r"r������png���)�write�_MAGIC�encoderinfo�get�size�sorted�set�appendr14�SAVE�mode�copy�	thumbnailr�15Resampling�LANCZOS�o16�len�tellrr�save�newr�_save�_Tile�seek�read�o32)�im�fp�filenamerr�frames�provided_ims�width�heightr.�provided_im�bits�	bits_used�other_im�frame�offset�colors�image_io�and_mask�image_bytes�	bytes_len�currents                      �XD:\code\apps\devtools\python\user_packages\Python313\site-packages\PIL/IcoImagePlugin.pyr=r=9sl���H�H�V��16�.�.�17�18�_�19-��206�C��N�N����R�
�E��F��4�"�.�.�,�,�_�b�A�A�L��G�G�M�E��s�5�z�"����7�U�?�d�1�g��.�$�q�'�C�-�4��7�S�=��'�K����4�'���M�M�+�&��%�*�*�;�+;�+;�<�Q�?��!�F�	� ,�H��}�}��,� �)�.�.�x�}�}�=�a�@�D��,��
�
�h�/�!�(�(��.�!-�
�!(�& �$�$�&�E��O�O�D�%�"2�"2�":�":��O�N��M�M�%� �3#�4�H�H�S��V��
��
�W�W�Y��V��r�)�
)�F����21�22�
��23����U�S�[�E�a�0�1�24����f�s�l�F��2�3�>A�~�*�*�5�:�:�6�q�r�:�w���f�25����F���26�����27�����28����T����9����J�J�x��'��r�z� �9�9�S�$�/��������_�_�U�F�T�M�1�l�K�L���
�J�J�x��'��
�
�a���m�m�o���%�b�q�/�C���29�O�;�k�"�#�>N�N�K���$�	�30����Y�� �31����V����'�'�)��32�����33������)�#��34�����I�c�,�UR[5$�N)�35startswithr+)�prefixs rU�_acceptr[�s�����V�$�$rVc��\rSrSr%S\S'S\S'S\S'S\S'S\S'S\S'S\S	'S\S36'S\S'S\S
'S\S'Srg)�37IconHeader��intrGrH�nb_color�reserved�planes�bppr.rN�tuple[int, int]�dim�square�color_depth�N)�__name__�38__module__�__qualname__�__firstlineno__�__annotations__�__static_attributes__rhrVrUr]r]�s;���J��K��M��M��K�	�H�39
�I��K�	���K��rVr]c�N�\rSrSrS	SjrS40SjrSSSjjrSS
SjjrSSjrSr	g)�IcoFile�c���URS5n[U5(d
Sn[U5eXl/Ul[US5Ul[UR5H�nURS5nUS=(d SnUS=(d SnUSn[US5n[UUUUS	[US5[US5[US415[US5XV4XV-U=(d* US:g=(a [[US55=(d SS9n	URRU	5 M� [URS
S9Ul[URSSS9Ulg)z<42Parse image from file-like object containing ico file data43�znot an ICO file�rrrr	r(�r'r))rGrHr`rarbrcr.rNrerfrgc��UR$rX)rg��xs rU�<lambda>�"IcoFile.__init__.<locals>.<lambda>�s��a�m�mrV)�keyc��UR$rX)rfrws rUryrz�s��a�h�hrVT)r{�reverseN)r@r[�SyntaxError�buf�entry�i16�nb_items�ranger]�i32rrr1r/)44�selfr�s�msg�irGrHr`rc�icon_headers45          rU�__init__�IcoFile.__init__�sD��
�H�H�Q�K���q�z�z�#�C��c�"�"�����46��A�q�	��
��t�}�}�%�A������A��a�D�K�C�E��q�T�[�S�F���t�H��a��)�C�$���!��1���1�a�y���1�I���A�Y��1�b�z��O��~� �T�H��M�$L�d�3�x��;K�6L�T�QT��K� 
�J�J���k�*�5&�8�D�J�J�,C�D��47��D�J�J�,>��M��48rVc�p�URVs1sHoRUR4iM sn$s snf)z949Get a set of all available icon sizes and color depths.50)r�rGrH)r��hs  rUr�
IcoFile.sizes�s+��.2�Z�Z�8�Z����!�(�(�#�Z�8�8��8s�!3c��[UR5H.up4XR:XdMUSLdX$R:XdM,Us $ g)NFr)�	enumerater�rerg)r�r.rcr�r�s     rU�
getentryindex�IcoFile.getentryindex�s9���d�j�j�)�D�A��u�u�}�#��,�#���2F���*�rVc�B�URURX55$)z51Get an image from the icon52)rMr�)r�r.rcs   rU�getimage�IcoFile.getimage�s���z�z�$�,�,�T�7�8�8rVc���URUnURRUR5 URR	S5nURRUR5 USS[53R:XaB[54R"UR5n[R"UR5 U$[R"UR5n[R"UR5 URS[URSS-54UlURSupVpx[ R""USUR-Xx5URS'UR$S:Xa�URRU5 URR	URSURS-S-5S	SS2n	[R&"S55URU	SS5n56O�URSnUS-S:�aUSURSS--57-
n[X�RS-S-5nURUR-U-58n
URRU
5 URR	U5n[R&"S
URUSS[US-5S45n59U60(a"UR-S5nUR/U615 U$![(a [ R*(aSn62NNef=f![(a [ R*(aSn63Nvef=f)z64Get an image from frame idx65r'Nrr	r(r$rrtru�Lr#)r�rr%r"z1;Ir%�RGBA)r�rr?rNr@r
r+�PngImageFiler�_decompression_bomb_checkr.r66�DibImageFiler_�_size�tilerr>rc�67frombuffer�68ValueError�LOAD_TRUNCATED_IMAGES�convert�putalpha)r��idx�header�datarB�d�e�o�a�alpha_bytes�mask�w�total_bytes�and_mask_offset�	mask_datas               rUrM�
IcoFile.frame�s���69���C������
�
�f�m�m�$��x�x�}�}�Q������
�
�f�m�m�$����8�~�,�,�,��,�,�T�X�X�6�B��+�+�B�G�G�4�V�	�Q �,�,�T�X�X�6�B��+�+�B�G�G�4�����70�C�����71�Q��$7�8�B�H������J�A�!�"����F�R�W�W�,<�a�C�B�G�G�A�J��z�z�R�����
�
�a� �"�h�h�m�m�B�G�G�A�J������,C�a�,G�H���A��N��� �+�+�����#��$��D��G�G�A�J����F�a�<���r�w�w�q�z�B��/�/�A�72"�1�w�w�q�z�>�Q�"6�7��"(�-�-�&�+�+�"=��"K�����
�
�o�.� �H�H�M�M�+�6�	�� �+�+�����!����A��E�73�B�/��D� ��Z�Z��'�����D�!��	��W"�� �6�6�#���	��<"�� �6�6�#���	�s$�.$L�33L9�!L6�4L6�9!M�M)rr�r�N)r�	IO[bytes]�return�None)r�zset[tuple[int, int]])F)r.rdrc�74int | boolr�r_)r.rdrcr�r��Image.Image)r�r_r�r�)75rirjrkrlr�rr�r�rMrnrhrVrUrprp�s��0N�d9��9�ZrVrpc�z�\rSrSrSrSrSrSSjr\S
Sj5r	\	RSSj5r	SSjrSS	jrS76r
g)�IcoImageFilei>a�77PIL read-only image support for Microsoft Windows .ico files.78 79By default the largest resolution image in the file will be loaded. This80can be changed by altering the 'size' attribute before calling 'load'.81 82The info dictionary has a key 'sizes' that is a list of the sizes available83in the icon file.84 85Handles classic, XP and Vista icon formats.86 87When saving, PNG compression is used. Support for this was only added in88Windows Vista. If you are unable to view the icon in Windows, convert the89image to "RGBA" mode before saving.90 91This plugin is a refactored version of Win32IconImagePlugin by Bryan Davis92<casadebender@gmail.com>.93https://code.google.com/archive/p/casadebender/wikis/Win32IconImagePlugin.wiki94�ICOzWindows Iconc��URce[UR5UlURR5URS'URR95SRUlUR5 g)Nrr)	rCrp�icor�infor�rer.�load�r�s rU�_open�IcoImageFile._openVs^���w�w�"�"�"��4�7�7�#���!�X�X�^�^�-��	�	�'���H�H�N�N�1�%�)�)��	��	�	�rVc��UR$rX)r�r�s rUr.�IcoImageFile.size]s���z�z�rVc�N�XRS;a
Sn[U5eXlg)Nrz2This is not one of the allowed sizes of this image)r�r�r�)r��valuer�s   rUr.r�as%���	�	�'�*�*�F�C��S�/�!��96rVc��URbCURRUR:Xa[RR	U5$UR97R
UR5nUR	5 URUlURUlUR(aURUl	URUR:wa�[R"S5 UR98RUR5n[URS5nURX2'[U5URS'URUl[RR	U5$)NzImage was not the expected sizer)�_imrBr.rr�r�r�r3�_mode�palette�warnings�warnr��listr�r0)r�rB�indexrs    rUr��IcoImageFile.loadhs���8�8��D�G�G�L�L�D�I�I�$=��;�;�#�#�D�)�)�
�X�X�
�
�t�y�y�
)��99���	��%�%����W�W��100�
�:�:��:�:�D�L�
�7�7�d�i�i���M�M�;�<��H�H�*�*�4�9�9�5�E�����7�+�,�E��7�7�E�L�!$�U��D�I�I�g�����D�I��{�{����%�%rVc��grXrh)r��poss  rU�	load_seek�IcoImageFile.load_seek~s��	
rV)r�r�r�rBr�r.N)r�r�)r�rd)r�rdr�r�)r�zImage.core.PixelAccess | None)r�r_r�r�)rirjrkrl�__doc__�format�format_descriptionr��propertyr.�setterr�r�rnrhrVrUr�r�>sO���(�F�'�������101�[�[����&�,
rVr�z.icozimage/x-icon)rBr�rCr�rDzstr | bytesr�r�)rZ�bytesr��bool)%�102__future__rr��ior�mathrr�typingrr�r103rrr
�_binaryrr�rr�rrr8rrAr+r=r[r]rpr��
register_openr��
register_save�register_extension�
register_mimerhrVrU�<module>r�s���J#����!�>�>�!�!��!�!�104105��J�Z%����_�_�LC
�9�&�&�C
�T���L�'�'��w�?����L�'�'��/�����,�,�f�5����L�'�'��8rV
codekingpro/portable-devtools · Team Ai