%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__/SpiderImagePlugin.cpython-312.pyc

�

��e�$��@�ddlmZddlZddlZddlZddlmZmZd�Zgd�Z	d�Z
d�ZGd	�d
ej�Zdd�Z
d�Zd
�Zd�Zej"ej$e�ej&ej$e�edk(�r�eej,�dkred�ej0�ej,dZee�sed�ej0�ej4e�5Zedee�z�edeej$�z�edeej:�z�edeej<�z�edd��eej?��eej,�dkDrxej,dZ ejCejDjF�ZedejHjKe��de �d��ejMe ej$�ddd�yy#1swYyxYw)�)�annotationsN�)�Image�	ImageFilec�X�	t|�}||z
dk(ryy#ttf$rYywxYw)Nrr)�int�
ValueError�
OverflowError)�f�is  �7/usr/lib/python3/dist-packages/PIL/SpiderImagePlugin.py�isIntr,s8�����F���q�5�A�:�����
�&����s��)�))r�i����i�i��i��c���d|z}dD]}t||�r�yt|d�}|tvryt|d�}t|d�}t|d�}|||zk7ry|S)N��c)r����
��rrrrr)rr�iforms)�t�hr�iform�labrec�labbyt�lenbyts       r
�isSpiderHeaderr @s}��
��	�A�
&����Q�q�T�{���
��!��I�E��F���
��2��Z�F�
��2��Z�F�
��2��Z�F�
�&�6�/�"���M�c��t|d�5}|jd�}ddd�tjd�}t	|�}|dk(r!tjd|�}t	|�}|S#1swY�RxYw)N�rb�\z>23frz<23f)�open�read�struct�unpackr )�filename�fprr�hdrlens     r
�
isSpiderImager,Tsp��	
�h��	����G�G�B�K����
�
�f�a� �A�
�A�
�F�
��{��M�M�&�!�$����"���M���s�A0�0A9c�X�eZdZdZdZdZd�Zed��Zed��Z	d�Z
d�Zdd	�Zd
�Z
y)
�SpiderImageFile�SPIDERzSpider 2D imageFc��d}|jj|�}	d|_tjd|�}t|�}|dk(r(d|_tjd|�}t|�}|dk(r
d}t
|��	d|z}t|d�}|dk7r
d	}t
|��t|d
�t|d�f|_	t|d�|_
t|d
�|_|jdk(r|jdk(r
|}	d|_n�|jdkDr[|jdk(rLt|d
�t|d�zdz|_
||_t|d�|_|dz}	d|_nB|jdk(r&|jdkDr||jz}	d|_
n
d}t
|��|jrd|_nd|_d|_dd|j$z|	|j ddffg|_|j|_y#tj$r}d}t
|�|�d}~wwxYw)N�lrz>27frz<27fznot a valid Spider filerrznot a Spider 2D imagerr����z inconsistent stack header valueszF;32BFzF;32F�F�raw�rr)r*r&�	bigendianr'r(r �SyntaxError�errorr�_size�istack�	imgnumber�_nimages�imgbytesr+�	stkoffset�rawmode�_mode�size�tile�_fp)
�self�nrrr+�msg�err�offsets
          r
�_openzSpiderImageFile._opends�����G�G�L�L��O��
	*��D�N��
�
�f�a�(�A�#�A�&�F���{�!"����M�M�&�!�,��'��*����{�/��!�#�&�&��
�A�I���A�a�D�	���A�:�)�C��c�"�"���2��Z��Q�q�T��*��
��!�B�%�j����Q�r�U�����;�;�!�����!� 3��F��D�M�
�[�[�1�_����1�!4���"��J��Q�q�T��2�Q�6�D�M� �D�K���"��J�D�M��a�Z�F��D�N�
�[�[�A�
�$�.�.�1�"4��d�n�n�,�F��D�K�4�C��c�"�"��>�>�#�D�L�"�D�L���
��V�d�i�i�/��$�,�,��1�9M�N�O��	��7�7����S�|�|�	*�+�C��c�"��)��	*�s�A'H!�!I�4I�Ic��|jS�N�r?�rGs r
�n_frameszSpiderImageFile.n_frames�s���}�}�r!c� �|jdkDS�NrrOrPs r
�is_animatedzSpiderImageFile.is_animated�s���}�}�q� � r!c�@�|jdkry|jdz
S)Nrr)r>rPs r
�tellzSpiderImageFile.tell�s ���>�>�A����>�>�A�%�%r!c�H�|jdk(r
d}t|��|j|�sy|j||j|jzzz|_|j|_|jj|j
�|j�y)Nrz#attempt to seek in a non-stack file)
r=�EOFError�_seek_checkr+r@rArFr*�seekrL)rG�framerIs   r
rZzSpiderImageFile.seek�sx���;�;�!��7�C��3�-������&�����u����d�m�m�0K�'L�L����(�(��������T�^�^�$��
�
�r!c��|j�\}}d}||k7r|||z
z}||z}|j||fd��jd�S)Nrc��||z|zSrN�)r�m�bs   r
�<lambda>z.SpiderImageFile.convert2byte.<locals>.<lambda>�s��a�!�e�a�i�r!�L)�
getextrema�point�convert)rG�depth�minimum�maximumr_r`s      r
�convert2bytezSpiderImageFile.convert2byte�sY��!�_�_�.���'�
���g����7�*�+�A�
�B��L���z�z�a�1�7�8�@�@��E�Er!c�P�ddlm}|j|j�d��S)Nr)�ImageTk�)�palette)�rk�
PhotoImageri)rGrks  r
�tkPhotoImagezSpiderImageFile.tkPhotoImage�s$����!�!�$�"3�"3�"5�s�!�C�Cr!N)�)�__name__�
__module__�__qualname__�format�format_description�!_close_exclusive_fp_after_loadingrL�propertyrQrTrVrZrirpr^r!r
r.r._sW��
�F�*��(-�%�9�v�����!��!�&�	�F�Dr!r.c��|�t|�dkryg}|D]}tjj|�st	d|����1	tj|�5}|j�}ddd�|jd<|j|���|S#1swY�-xYw#t$rt|�st	|dz�Y��wxYw)zJcreate a list of :py:class:`~PIL.Image.Image` objects for use in a montageNrzunable to find z is not a Spider image filer))�len�os�path�exists�printrr%ri�	Exceptionr,�info�append)�filelist�imglist�img�ims    r
�loadImageSeriesr��s�����3�x�=�1�,���G�����w�w�~�~�c�"��O�C�5�)�*��	����C��
'�B��_�_�&��
'�"����
�����r����N�
'�
'���	� ��%��c�9�9�:��	�s*�B&�B�.B&�B#	�B&�&"C�
Cc���|j\}}|dz}td|z�}d|zdk7r|dz
}||z}t|dz�}|dkrgSdg|z}d|d<t|�|d<t|�|d	<d|d
<t|�|d<t|�|d<t|�|d
<t|�|d<|dd}|jd�|D�cgc]}t	j
d|���c}Scc}w)Nr4irrrgg�?rrrrrrr)rDr�floatr�r'�pack)	r��nsam�nrowrrr�nvalues�hdr�vs	         r
�makeSpiderHeaderr��s�����J�D�$�
�A�X�F�
����
�F��f�}����!���
�f�_�F��&�1�*�o�G���|��	��%�'�/�C��C��F�
�4�[�C��F�
�4�[�C��F�
�C��F��D�k�C��G��F�m�C��G��F�m�C��G��F�m�C��G��a�b�'�C��J�J�s�O�),�-�A�F�K�K��Q��-�-��-s�C(c
��|jddk7r|jd�}t|�}t|�dkr
d}t	|��|j|�d}t
j||dd|jzd|ddffg�y)	Nrr6rlzError creating Spider headerzF;32NFr7r8r)	�moderer�rz�OSError�
writelinesr�_saverD)r�r*r)r�rIrBs      r
r�r�s���	�w�w�q�z�S��
�Z�Z��_��
�2�
�C�
�3�x�#�~�,���c�l���M�M�#���G�
�O�O�B��e�V�b�g�g�%5�q�7�A�q�/�J�K�Lr!c��tjj|�d}tjt
j|�t|||�yrS)r{r|�splitextr�register_extensionr.rur�)r�r*r)�exts    r
�_save_spiderr�s=��
�'�'�
�
�8�
$�Q�
'�C�	���_�3�3�S�9�	�"�b�(�r!�__main__rz7Syntax: python3 SpiderImagePlugin.py [infile] [outfile]z$input image must be in Spider formatzimage: zformat: zsize: zmode: z
max, min: � )�endzsaving a flipped version of z as rN)'�
__future__rr{r'�sysrnrrrrr r,r.r�r�r�r��
register_openru�
register_saverrrz�argvr~�exitr)r%r��strrDr�rc�outfile�	transpose�	Transpose�FLIP_LEFT_RIGHTr|�basename�saver^r!r
�<module>r�s���F#�	�
�
���
$���(�gD�i�)�)�gD�^�4.�<
M� �����O�*�*�O�<�����O�*�*�L�9��z��
�3�8�8�}�q��
�G�H�����
��x�x��{�H���"�
�4�5�����
�	����H�	�5��
�i�#�b�'�!�"�
�j�3�r�y�y�>�)�*�
�h��R�W�W��%�&�
�h��R�W�W��%�&�
�l��$�
�b�m�m�o���s�x�x�=�1���h�h�q�k�G����e�o�o�=�=�>�B��.�r�w�w�/?�/?��/I�.J�K��Y�a�!�
�
�G�G�G�_�3�3�4�#5�5��5�5�s
�:DH�H

Zerion Mini Shell 1.0