3
`JZ                 @   sz   d dl mZmZ d dlmZ d dlmZ dZyddl	Z	W n  e
k
rX   ddlZeZ	Y nX G dd dejZdd
dZdS )   )	ImageFileImagePalette)i16be)isPathz0.1    Nc               @   s   e Zd ZdZdZdd ZdS )GdImageFileZGDzGD uncompressed imagesc             C   s   | j jd}d| _t|dd t|dd f| _t|dd }|dk rV|| jd	< tjd
|dd  | _dd| j ddfg| _	d S )Ni  Lr                  ZtransparentZRGBrawr   )r   r   )r   r   r   )
fpreadmodei16sizeinfor   r   ZpaletteZtile)selfsZtindex r   1/usr/lib/python3/dist-packages/PIL/GdImageFile.py_open2   s    "
zGdImageFile._openN)__name__
__module____qualname__formatZformat_descriptionr   r   r   r   r   r   -   s   r   rc             C   sZ   |dkrt dt| r*| }tj| d} nd}y
t| |S  tk
rT   tdY nX dS )a)  
    Load texture from a GD image file.

    :param filename: GD file name, or an opened file handle.
    :param mode: Optional mode.  In this version, if the mode argument
        is given, it must be "r".
    :returns: An image instance.
    :raises IOError: If the image could not be read.
    r   zbad moderb zcannot identify this image fileN)
ValueErrorr   builtinsopenr   SyntaxErrorIOError)r   r   filenamer   r   r   r$   D   s    

r$   )r   )r!   r   r   Z_binaryr   r   Z_utilr   __version__r#   ImportErrorZ__builtin__r   r$   r   r   r   r   <module>   s   
	