
hR\                 @   s   d  d l  m Z m Z d  d l m Z d  d l m Z d Z y d d l	 Z	 Wn$ e
 k
 rr d d l Z e Z	 Yn XGd 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  r| | |  j d	 <n  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   D/var/www/dbchiro/venv/lib/python3.4/site-packages/PIL/GdImageFile.py_open2   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$   D   s    
r$   )r!   r   r   Z_binaryr   r   Z_utilr   __version__r#   ImportError__builtin__r   r$   r   r   r   r   <module>   s   	