î
úÙ Xž  ã               @   sž   d  d l  m Z m Z m Z d  d l m Z d Z y d  d l Z Wn$ e k
 rh d  d l	 Z	 e	 Z Yn Xe j
 Z Gd d „  d e j ƒ Z d d d	 „ Z d S)
é    )Ú	ImageFileÚImagePaletteÚ_binary)ÚisPathz0.1Nc               @   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  r| | |  j d	 <n  t j d
 | d d  … ƒ |  _ d d |  j d d f g |  _	 d  S)Ni  ÚLr   é   é   é   é   é   ZtransparentZRGBÚrawé   )r   r   éÿÿÿÿ)r   r   r   )
ÚfpÚreadÚmodeÚi16ÚsizeÚinfor   r   ZpaletteZtile)ÚselfÚsZtindex© r   úL/home/ubuntu/projects/ifolica/lib/python3.4/site-packages/PIL/GdImageFile.pyÚ_open3   s    	/zGdImageFile._openN)Ú__name__Ú
__module__Ú__qualname__ÚformatZformat_descriptionr   r   r   r   r   r   .   s   r   Úrc             C   s~   | d k r t  d ƒ ‚ n  t |  ƒ rB |  } t j |  d ƒ }  n d } y t |  | ƒ SWn t k
 ry t d ƒ ‚ Yn Xd 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$   E   s    
r$   )ZPILr   r   r   Z	PIL._utilr   Ú__version__r#   ÚImportErrorÚ__builtin__Zi16ber   r   r$   r   r   r   r   Ú<module>   s   		