
n+Oc            @   su  d  Z  y d d k Z Wn e j
 o e Z n Xd f  d     YZ y e d  Wn e j
 o n Xy d d k Z e Z [ WnP e j
 oD Z e   Z e	 e  d  d j o e o e i
 d e  n n Xd d k Z d d k Z d d k Z d d k Z d d k Z d d	 k l Z l Z l Z y e e d
   Z d   Z Wn e j
 o d   Z n Xd   Z d   Z d   Z d d k l Z l Z d Z  d Z! d Z" d Z# d Z$ d Z% d Z& d Z' d Z( d Z) d Z* d Z+ d Z! d Z, d Z- d Z. Z/ d Z0 Z1 d Z! d Z, d Z2 d Z3 d Z4 d Z5 d Z6 d Z7 d Z8 d Z9 g  Z: h  Z; h  Z< h  Z= h  Z> h
 d d d f f d 6d d d f f d 6d d d f f d 6d d d f f d 6d d d f f d 6d d d d d f f d 6d d d d d d f f d  6d d d d d d! f f d" 6d d d# d$ d% d& f f d' 6d d d% d( d) f f d* 6Z? y e i@ Z@ WnL eA j
 o@ d d kB ZB eB iC d+ d,  d d j o
 d- Z@ n d. Z@ n Xe@ d. j o
 d/ ZD n d0 ZD h
 d1 e f d 6d2 e f d 6eD d3 e f d 6eD d4 e f d 6d2 e f d 6d2 d f d 6d2 d f d  6d2 d f d" 6d2 d f d' 6d2 d f d* 6ZE d5   ZF e? iG   ZH eH iI   d d d  d" d' d6 d7 d8 f ZJ d9   ZK d:   ZL d;   ZM d<   ZN d aO d=   ZP d>   ZQ f  d?  ZR f  d@  ZS dA f  dB     YZT dC   ZU dD f  dE     YZV dF eV f dG     YZW dH f  dI     YZX dJ f  dK     YZY dL   ZZ d dM  Z[ dN dO  Z\ dN dP  Z] e dQ  Z^ h d d f d d f d2 f 6d dR f d d f dS f 6d d6 f d d f dT f 6d d8 f d d f dU f 6d dV f d d f dW f 6d dX f d d f dY f 6d dZ f d d f d[ f 6d d\ f d d f d] f 6d d^ f d d f d_ f 6d d` f d d f da f 6d d f d d d f d2 f 6d" d" f d d d f d2 f 6Z_ d d f e_ d d f eD d3 f <d d f e_ d d f eD d4 f <db dc  Z` dd   Za de   Zb df   Zc dg   Zd e dh  Ze di   Zf dj   Zg dk   Zh dl   Zi e dm  Zj d S(n   s   1.1.7iNt   _imaging_not_installedc           B   s   e  Z d    Z RS(   c         C   s   t  d   d  S(   Ns&   The _imaging C module is not installed(   t   ImportError(   t   selft   id(    (    s3   /usr/local/lib/python2.6/dist-packages/PIL/Image.pyt   __getattr__$   s    (   t   __name__t
   __module__R   (    (    (    s3   /usr/local/lib/python2.6/dist-packages/PIL/Image.pyR    "   s   t   FixTki   s   Module use of pythonsc   The _imaging extension was built for another version of Python; most PIL functions will be disabled(   t   IntTypet
   StringTypet	   TupleTypet    c         C   s   t  |  t  p t  |  t  S(   N(   t
   isinstanceR	   t   UnicodeStringType(   t   t(    (    s3   /usr/local/lib/python2.6/dist-packages/PIL/Image.pyt   isStringTypeS   s    c         C   s   t  |  t  S(   N(   R   R	   (   R   (    (    s3   /usr/local/lib/python2.6/dist-packages/PIL/Image.pyR   V   s    c         C   s   t  |  t  S(   N(   R   R
   (   R   (    (    s3   /usr/local/lib/python2.6/dist-packages/PIL/Image.pyt   isTupleType\   s    c         C   s   t  |  d  S(   Nt   im(   t   hasattr(   R   (    (    s3   /usr/local/lib/python2.6/dist-packages/PIL/Image.pyt   isImageTypeb   s    c         C   s   t  |   o t i i |   S(   N(   R   t   ost   patht   isdir(   t   f(    (    s3   /usr/local/lib/python2.6/dist-packages/PIL/Image.pyt   isDirectoryi   s    (   t   isNumberTypet   isSequenceTypei    i   i   i   i   t   Lt   1t   It   Ft   RGBt   Pt   Rt   Gt   Bt   Xt   RGBXt   At   RGBAt   Ct   Mt   Yt   Kt   CMYKt   Cbt   Crt   YCbCrt   ht    t   bigt   littlet   <t   >s   |b1s   |u1t   i4t   f4c         C   sZ   |  i  d |  i  d f } t |  i \ } } | d  j o | | f S| | f | f Sd  S(   Ni   i    (   t   sizet
   _MODE_CONVt   modet   None(   R   t   shapet   typt   extra(    (    s3   /usr/local/lib/python2.6/dist-packages/PIL/Image.pyt   _conv_type_shape   s
    s   I;16s   I;16Ls   I;16Bc         C   s   t  i |   i S(   N(   t	   ImageModet   getmodet   basemode(   R:   (    (    s3   /usr/local/lib/python2.6/dist-packages/PIL/Image.pyt   getmodebase   s    c         C   s   t  i |   i S(   N(   R@   RA   t   basetype(   R:   (    (    s3   /usr/local/lib/python2.6/dist-packages/PIL/Image.pyt   getmodetype   s    c         C   s   t  i |   i S(   N(   R@   RA   t   bands(   R:   (    (    s3   /usr/local/lib/python2.6/dist-packages/PIL/Image.pyt   getmodebandnames  s    c         C   s   t  t i |   i  S(   N(   t   lenR@   RA   RF   (   R:   (    (    s3   /usr/local/lib/python2.6/dist-packages/PIL/Image.pyt   getmodebands  s    c          C   s   t  d j o d Sy d d k }  Wn t j
 o n Xy d d k } Wn t j
 o n Xy d d k } Wn t j
 o n Xy d d k } Wn t j
 o n Xy d d k } Wn t j
 o n Xd a  d S(   s"   Load standard file format drivers.i   Ni(   t   _initializedt   BmpImagePluginR   t   GifImagePlugint   JpegImagePlugint   PpmImagePlugint   PngImagePlugin(   RK   RL   RM   RN   RO   (    (    s3   /usr/local/lib/python2.6/dist-packages/PIL/Image.pyt   preinit"  s.    c          C   s|  t  d j o d Sh  }  t i } y | t i i t  g } Wn t j
 o n Xxt t |  D] } t i i	 |  } |  i
 |  o qd n x t i |  D] } | d d j o t i i |  \ } } yB t i i d |  z t | t   t   g   Wd t i d =XWqMt j
 o& t o d G| Gd Gt i GHqIqMXq q Wd |  | <qd Wt p t o d a  d Sd S(	   s   Load all file format drivers.i   i    is   ImagePlugin.pyNs   Image: failed to importt   :i   (   RJ   t   sysR   R   t   dirnamet   __file__t	   NameErrort   filterR   t   abspatht   has_keyt   listdirt   splitextt   insertt
   __import__t   globalst   localsR   t   DEBUGt	   exc_valueR;   t   OPENt   SAVE(   t   visitedt   directoriest	   directoryt   fullpatht   fileR   t   e(    (    s3   /usr/local/lib/python2.6/dist-packages/PIL/Image.pyt   initH  s<    	  !c         C   s   | d  j o
 d } n t |  p | f } n y/ t t | d  } t | |  f | |  SWn# t j
 o t d |   n Xd  S(   Nt   _decoders   decoder %s not available(    (   R;   R   t   getattrt   coret   applyt   AttributeErrort   IOError(   R:   t   decoder_namet   argsR>   t   decoder(    (    s3   /usr/local/lib/python2.6/dist-packages/PIL/Image.pyt   _getdecoders  s    
c         C   s   | d  j o
 d } n t |  p | f } n y/ t t | d  } t | |  f | |  SWn# t j
 o t d |   n Xd  S(   Nt   _encoders   encoder %s not available(    (   R;   R   Rk   Rl   Rm   Rn   Ro   (   R:   t   encoder_nameRq   R>   t   encoder(    (    s3   /usr/local/lib/python2.6/dist-packages/PIL/Image.pyt   _getencoder  s    
t   _Ec           B   s,   e  Z d    Z d   Z d   Z d   Z RS(   c         C   s   | |  _  d  S(   N(   t   data(   R   Ry   (    (    s3   /usr/local/lib/python2.6/dist-packages/PIL/Image.pyt   __init__  s    c         C   s   |  t  |  f S(   N(   Rx   (   R   t   other(    (    s3   /usr/local/lib/python2.6/dist-packages/PIL/Image.pyt
   __coerce__  s    c         C   s   t  |  i d | i f  S(   Nt   __add__(   Rx   Ry   (   R   R{   (    (    s3   /usr/local/lib/python2.6/dist-packages/PIL/Image.pyR}     s    c         C   s   t  |  i d | i f  S(   Nt   __mul__(   Rx   Ry   (   R   R{   (    (    s3   /usr/local/lib/python2.6/dist-packages/PIL/Image.pyR~     s    (   R   R   Rz   R|   R}   R~   (    (    (    s3   /usr/local/lib/python2.6/dist-packages/PIL/Image.pyRx     s   			c         C   s9  d g } |  t  |   i } yw | \ } } } | | j o% | d j o t |  o | d f S| | j o% | d j o t |  o d | f SWn t j
 o n Xyh | \ \ } } } } } | | j o? | d j o2 t |  o% | d j o t |  o | | f SWn t j
 o n Xt d   d  S(   Nt   stubR~   g        R}   g      ?s   illegal expression(   Rx   Ry   R   t	   TypeErrort
   ValueError(   t   exprR   Ry   t   at   bt   ct   dRh   (    (    s3   /usr/local/lib/python2.6/dist-packages/PIL/Image.pyt   _getscaleoffset  s$    	'' ' t   Imagec           B   s-  e  Z d6 Z d6 Z d    Z d   Z e Z d   Z d6 d6 d  Z	 d   Z
 d   Z d d  Z d d	  Z d d
  Z d   Z d   Z d6 d6 d6 e d d  Z d d d d6 d  Z d   Z d6 d  Z d   Z d6 d  Z d   Z d   Z d   Z d d  Z d6 d  Z d   Z d   Z d   Z d   Z  d   Z! d6 d6 d  Z" d6 d   Z# d6 d6 d!  Z$ d6 d"  Z% d#   Z& d$ d% d&  Z' d' d(  Z( d)   Z) e* d*  Z+ e* d d+  Z, d6 d,  Z- d-   Z. d6 d6 d.  Z/ d/   Z0 d0   Z1 e* d1  Z2 d6 e* d2 d3  Z3 e* d2 d4  Z4 d5   Z5 RS(7   c         C   sC   d  |  _ d |  _ d |  _ d  |  _ h  |  _ t |  _ d |  _ d  S(   NR   i    (   i    i    (	   R;   R   R:   R8   t   palettet   infot   NORMALt   categoryt   readonly(   R   (    (    s3   /usr/local/lib/python2.6/dist-packages/PIL/Image.pyRz     s    						c         C   s   t    } | | _ | i | _ | i | _ |  i | _ | i d j o t i   | _ n y |  i i   | _ WnC t j
 o7 h  | _ x) |  i D] \ } } | | i | <q Wn X| S(   NR    (	   R   R   R:   R8   R   t   ImagePaletteR   t   copyRn   (   R   R   t   newt   kt   v(    (    s3   /usr/local/lib/python2.6/dist-packages/PIL/Image.pyt   _new  s    			
 c         C   s)   |  i    |  i i   |  _ d |  _ d  S(   Ni    (   t   loadR   R   R   (   R   (    (    s3   /usr/local/lib/python2.6/dist-packages/PIL/Image.pyt   _copy  s    
c         C   sx   d d  k  } | p | i   } n |  i   | p | d j o |  i i |  n | d | } |  i | |  | S(   Nit   PPMt   .(   t   tempfilet   mktempR   R   t   save_ppmt   save(   R   Rg   t   formatR   (    (    s3   /usr/local/lib/python2.6/dist-packages/PIL/Image.pyt   _dump  s    
c         C   s=   d |  i  i |  i  i |  i |  i d |  i d t |   f S(   Ns(   <%s.%s image mode=%s size=%dx%d at 0x%X>i    i   (   t	   __class__R   R   R:   R8   R   (   R   (    (    s3   /usr/local/lib/python2.6/dist-packages/PIL/Image.pyt   __repr__  s    c         C   s^   | d j oA h  } t  |   \ } } | | d <| | d <|  i   | d <| St |   d  S(   Nt   __array_interface__R<   t   typestrRy   (   R?   t   tostringRn   (   R   t   nameR   R<   R   (    (    s3   /usr/local/lib/python2.6/dist-packages/PIL/Image.pyR     s    

t   rawc   	      G   s  t  |  d j o t | d  o | d } n | d j o | d j o |  i } n |  i   t |  i | |  } | i |  i  t d |  i d d  } g  } x4 | i	 |  \ } } } | i
 |  | o Pq q | d j  o t d |   n t i | d  S(	   s   Return image as a binary stringi   i    R   i   i   s   encoder error %d in tostringR   (    (   RH   R   R:   R   Rw   t   setimageR   t   maxR8   t   encodet   appendt   RuntimeErrort   stringt   join(	   R   Ru   Rq   Rh   t   bufsizeRy   t   lt   sR   (    (    s3   /usr/local/lib/python2.6/dist-packages/PIL/Image.pyR   
  s"    $
t   imagec         C   s~   |  i    |  i d j o t d   n |  i d  } t i d | |  i d f d | |  i d f d | | d	 g d
  S(   s   Return image as an XBM bitmapR   s   not a bitmapt   xbms   #define %s_width %d
i    s   #define %s_height %d
i   s   static char %s_bits[] = {
s   };R   (   R   R:   R   R   R   R   R8   (   R   R   Ry   (    (    s3   /usr/local/lib/python2.6/dist-packages/PIL/Image.pyt   tobitmap/  s    
c         G   s   t  |  d j o t | d  o | d } n | d j o | d j o |  i } n t |  i | |  } | i |  i  | i |  } | d d j o t d   n | d d j o t d   n d S(   s%   Load data to image from binary stringi   i    R   s   not enough image datas   cannot decode image dataN(    (   RH   R   R:   Rs   R   R   t   decodeR   (   R   Ry   Rp   Rq   R   R   (    (    s3   /usr/local/lib/python2.6/dist-packages/PIL/Image.pyt
   fromstringA  s    $c         C   s   |  i  o |  i o |  i i o t |  i  i |  i i    d |  i _ d |  i _ d |  i _ |  i	 i
 d  o* |  i  i |  i	 d d  d |  i _ q n |  i  o |  i  i |  i  Sd S(   s   Explicitly load pixel data.i    R   t   transparencyR'   N(   R   R   t   dirtyRm   t
   putpalettet   getdataR:   R;   t   rawmodeR   RX   t   putpalettealphat   pixel_accessR   (   R   (    (    s3   /usr/local/lib/python2.6/dist-packages/PIL/Image.pyR   ^  s    !
c         C   s   d S(   s   Verify file contents.N(    (   R   (    (    s3   /usr/local/lib/python2.6/dist-packages/PIL/Image.pyt   verifyt  s    i   c         C   s  | pL |  i  d j o. |  i   |  i o |  i i  } qO d } qS |  i   Sn |  i   | o@ | d j o t d   n |  i i | |  } |  i |  S| d j o- | t j o  |  i i	 |  } |  i |  S| d j o
 t } n y |  i i | |  } Wnf t j
 oZ y1 |  i i t |  i    } | i | |  } Wqwt j
 o t d   qwXn X|  i |  S(   s   Convert to other pixel formatR    R   R   s   illegal conversion(   R   s   RGBN(   R:   R   R   R   R   R   t   convert_matrixR   t   ADAPTIVEt   quantizeR;   t   FLOYDSTEINBERGt   convertRC   t   KeyError(   R   R:   Ry   t   ditherR   t   colorsR   (    (    s3   /usr/local/lib/python2.6/dist-packages/PIL/Image.pyR     s6    




i    c         C   s   |  i    | o | i    | i d j o t d   n |  i d j o  |  i d j o t d   n |  i i d d | i  } |  i |  S|  i i | | |  } |  i |  S(   NR    s   bad mode for palette imageR   R   s7   only RGB or L mode images can be quantized to a palettei   (   R   R:   R   R   R   t	   _makeselfR   R   (   R   R   t   methodt   kmeansR   R   (    (    s3   /usr/local/lib/python2.6/dist-packages/PIL/Image.pyR     s    	

 c         C   s&   |  i    |  i i   } |  i |  S(   s   Copy raster data(   R   R   R   R   (   R   R   (    (    s3   /usr/local/lib/python2.6/dist-packages/PIL/Image.pyR     s    
c         C   s/   |  i    | d j o |  i   St |  |  S(   s   Crop region from imageN(   R   R;   R   t
   _ImageCrop(   R   t   box(    (    s3   /usr/local/lib/python2.6/dist-packages/PIL/Image.pyt   crop  s    
c         C   s   d S(   s   Configure image decoderN(    (   R   R:   R8   (    (    s3   /usr/local/lib/python2.6/dist-packages/PIL/Image.pyt   draft  s    c         C   s@   | d  j o
 | } n |  i   |  i |  i i | | d   S(   Ni    (   R;   R   R   R   t   expand(   R   t   xmargint   ymargin(    (    s3   /usr/local/lib/python2.6/dist-packages/PIL/Image.pyt   _expand  s    

c         C   s   |  i    t |  o |   } n t | d  p t d   n |  i i d j o |  i | i |  i   Sg  } xE t |  i i  D]1 } | i	 |  i | i |  i i
 |     q Wt |  i |  S(   s!   Apply environment filter to imageRV   s>   filter argument should be ImageFilter.Filter instance or classi   (   R   t   callableR   R   R   RF   R   RV   t   rangeR   t   getbandt   mergeR:   (   R   RV   t   imsR   (    (    s3   /usr/local/lib/python2.6/dist-packages/PIL/Image.pyRV   "  s    
 /c         C   s   t  i |  i  i S(   s   Get band names(   R@   RA   R:   RF   (   R   (    (    s3   /usr/local/lib/python2.6/dist-packages/PIL/Image.pyt   getbands:  s    c         C   s   |  i    |  i i   S(   s:   Get bounding box of actual data (non-zero pixels) in image(   R   R   t   getbbox(   R   (    (    s3   /usr/local/lib/python2.6/dist-packages/PIL/Image.pyR   G  s    
c         C   s   |  i    |  i d j oo |  i i   } g  } x: t d  D], } | | o | i | | | f  q< q< Wt |  | j o d S| S|  i i |  S(   s(   Get colors from image, up to given limitR   R   R    i   (   R   R   R    N(	   R   R:   R   t	   histogramR   R   RH   R;   t	   getcolors(   R   t	   maxcolorsR0   t   outt   i(    (    s3   /usr/local/lib/python2.6/dist-packages/PIL/Image.pyR   U  s    
 c         C   s/   |  i    | d j	 o |  i i |  S|  i S(   s"   Get image data as sequence object.N(   R   R;   R   R   (   R   t   band(    (    s3   /usr/local/lib/python2.6/dist-packages/PIL/Image.pyR   t  s    
c         C   sw   |  i    |  i i d j oM g  } x9 t |  i i  D]% } | i |  i i |  i    q6 Wt |  S|  i i   S(   s   Get min/max valuei   (   R   R   RF   R   R   R   t
   getextremat   tuple(   R   t   extremaR   (    (    s3   /usr/local/lib/python2.6/dist-packages/PIL/Image.pyR     s    
 #c         C   s   |  i    |  i i S(   s.   Get PyCObject pointer to internal image memory(   R   R   t   ptr(   R   (    (    s3   /usr/local/lib/python2.6/dist-packages/PIL/Image.pyt   getim  s    
c         C   s?   |  i    y t t |  i i    SWn t j
 o d SXd S(   s   Get palette contents.N(   R   t   mapt   ordR   t
   getpaletteR   R;   (   R   (    (    s3   /usr/local/lib/python2.6/dist-packages/PIL/Image.pyR     s
    
c         C   s   |  i    |  i i |  S(   s   Get pixel value(   R   R   t   getpixel(   R   t   xy(    (    s3   /usr/local/lib/python2.6/dist-packages/PIL/Image.pyR     s    
c         C   s;   |  i    |  i i   \ } } t t |  t t |  f S(   s   Get projection to x and y axes(   R   R   t   getprojectionR   R   (   R   t   xt   y(    (    s3   /usr/local/lib/python2.6/dist-packages/PIL/Image.pyR     s    
c         C   s}   |  i    | o! | i    |  i i d | i  S|  i d j o. | d j o |  i   } n |  i i |  S|  i i   S(   s   Take histogram of imagei    R   R   (   i    i    (   R   R   N(   R   R   R   R:   R;   R   (   R   t   maskR   (    (    s3   /usr/local/lib/python2.6/dist-packages/PIL/Image.pyR     s    

c         C   s@   t  o t  i d t d d n d d k } | i |  | |  S(   sA   (deprecated) Offset image in horizontal and/or vertical directions7   'offset' is deprecated; use 'ImageChops.offset' insteadt
   stackleveli   iN(   t   warningst   warnt   DeprecationWarningt
   ImageChopst   offset(   R   t   xoffsett   yoffsetR   (    (    s3   /usr/local/lib/python2.6/dist-packages/PIL/Image.pyR     s    c         C   s  t  |  o | d j o | } d } n | d j o d
 |  i } n t |  d j ol t  |  o | i } n' t  |  o | i } n t d   | | d | d | d | d f } n t |  o% d d k } | i | |  i  } nr t  |  od | i	   |  i | i j o: |  i d j p | i d j o | i
 |  i  } q]n | i } n |  i	   |  i o |  i   n | o' | i	   |  i i | | | i  n |  i i | |  d S(   s   Paste other image into regioni    i   s,   cannot determine region size; use 4-item boxi   iNR   R'   t   RGBa(   i    i    (   s   RGBAR   (   R   R;   R8   RH   R   R   t
   ImageColort   getcolorR:   R   R   R   R   R   t   paste(   R   R   R   R   R8   R   (    (    s3   /usr/local/lib/python2.6/dist-packages/PIL/Image.pyR   #  s:     
	,
 


c         C   s   |  i    t | t  o | i |   St |  pb |  i d j o/ t |  \ } } |  i |  i i	 | |   St
 | t d   |  i i } n |  i d j o t d   n |  i |  i i | |   S(   s   Map image through lookup tableR   s   I;16R   i   s+   point operation not supported for this mode(   R   s   I;16R   (   R   R   t   ImagePointHandlert   pointR   R:   R   R   R   t   point_transformR   R   RF   R   (   R   t   lutR:   t   scaleR   (    (    s3   /usr/local/lib/python2.6/dist-packages/PIL/Image.pyR   ^  s    
#c         C   s  |  i    |  i o |  i   n |  i d
 j o y t |  i  d } y |  i i |  WnN t t f j
 o< |  i i	 |  } | i d j o
 t  n | |  _ n X|  i i |  _ Wq t
 t f j
 o t d   q Xn |  i d j o
 d } n d } t |  oQ | i d j o t d   n | i    | i d j o | i	 d  } qnM y |  i i | |  Wn. t t f j
 o t d |  i |  } n Xd	 S|  i i | i |  d	 S(   s   Set alpha layert   LAR'   R&   s   illegal image modei   i   R   R   N(   R   s   RGBA(   R   s   RGBA(   R   R   (   R   R   R   R:   RC   R   t   setmodeRn   R   R   R   R   t   fillbandR   R8   t   putband(   R   t   alphaR:   R   R   (    (    s3   /usr/local/lib/python2.6/dist-packages/PIL/Image.pyt   putalpha~  s>    




g      ?g        c         C   s<   |  i    |  i o |  i   n |  i i | | |  d S(   s.   Put data from a sequence object into an image.N(   R   R   R   R   t   putdata(   R   Ry   R   R   (    (    s3   /usr/local/lib/python2.6/dist-packages/PIL/Image.pyR    s    

R   c         C   s   |  i  d j o t d   n |  i   t | t i  o t i | i | i  } n? t |  p t	 i
 t t |  d  } n t i | |  } d |  _  | |  _ d |  i _  |  i   d S(   s   Put palette data into an image.R   R    s   illegal image modeR   R   N(   R   R    (   R:   R   R   R   R   R   R   R   R   R   R   R   t   chr(   R   Ry   R   R   (    (    s3   /usr/local/lib/python2.6/dist-packages/PIL/Image.pyR     s    
		c         C   s5   |  i    |  i o |  i   n |  i i | |  S(   s   Set pixel value(   R   R   R   R   t   putpixel(   R   R   t   value(    (    s3   /usr/local/lib/python2.6/dist-packages/PIL/Image.pyR    s    

c         C   s   | t  t t t f j o t d   n |  i   |  i d j o
 t  } n | t j o? y |  i i | |  } Wq t	 j
 o t d   q Xn |  i i
 | |  } |  i |  S(   s   Resize images   unknown resampling filterR   R    s   unsupported resampling filter(   R   R    (   t   NEARESTt   BILINEARt   BICUBICt	   ANTIALIASR   R   R:   R   t   stretchRn   t   resizeR   (   R   R8   t   resampleR   (    (    s3   /usr/local/lib/python2.6/dist-packages/PIL/Image.pyR
    s    

c         C   s  | od d k  } | | i d } | i |  | i |  d | i |  | i |  d g } | d  } |  i \ } } g  }	 g  }
 xa d | d f | | f d | f f D]; \ } } | | |  \ } } |	 i |  |
 i |  q Wt | i t |	   | i	 t
 |	    } t | i t |
   | i	 t
 |
    } | | d | d  \ } } |  i d d | | d <|  i d	 d | | d
 <|  i | | f t | |  S| t t t f j o t d   n |  i   |  i d j o
 t } n |  i |  i i | |   S(   s8   Rotate image.  Angle given as degrees counter-clockwise.iNi   g        c   	      S   sB   | \ } } } } } } | |  | | | | |  | | | f S(   N(    (	   R   R   t   .2R   R   R   R   Rh   R   (    (    s3   /usr/local/lib/python2.6/dist-packages/PIL/Image.pyt	   transform7  s    i    g       @i   i   i   s   unknown resampling filterR   R    (   i    i    (   R   R    (   t   matht   pit   cost   sinR8   R   t   intt   ceilR   t   floort   minR  t   AFFINER  R  R  R   R   R:   R   R   t   rotate(   R   t   angleR  R   R  t   matrixR  t   wR0   t   xxt   yyR   R   (    (    s3   /usr/local/lib/python2.6/dist-packages/PIL/Image.pyR  -  s4    "% ..

c   	      K   s  t  |  o
 | } n4 t | d  o t  | i  o | i } n d } |  i   | |  _ d |  _ t   t i t	 i
 i |  d  } | p_ y t | } Wq t j
 o> t   y t | } Wq t j
 o t |   q Xq Xn y t t i |  } Wn- t j
 o! t   t t i |  } n Xt  |  o( d d k } | i | d  } d } n d } z | |  | |  Wd | o | i   n Xd S(	   s   Save image to file or streamR   R   i   iNt   wbi    (    (   R   R   R   R   t   encoderinfot   encoderconfigRP   R   t   lowerR   R   RZ   t	   EXTENSIONR   Ri   Rb   t   uppert   __builtin__t   opent   close(	   R   t   fpR   t   paramst   filenamet   extt   save_handlerR#  R%  (    (    s3   /usr/local/lib/python2.6/dist-packages/PIL/Image.pyR   r  sB    
 
		
c         C   s   | d j o
 t   n d S(   s$   Seek to given frame in sequence filei    N(   t   EOFError(   R   t   frame(    (    s3   /usr/local/lib/python2.6/dist-packages/PIL/Image.pyt   seek  s    c         C   s   t  |  d | d | d S(   s'   Display image (for debug purposes only)t   titlet   commandN(   t   _show(   R   R.  R/  (    (    s3   /usr/local/lib/python2.6/dist-packages/PIL/Image.pyt   show  s    c         C   s   |  i  i d j o |  i   g } nP g  } |  i   x< t |  i  i  D]( } | i |  i |  i  i |    qI Wt |  S(   s   Split image into bandsi   (	   R   RF   R   R   R   R   R   R   R   (   R   R   R   (    (    s3   /usr/local/lib/python2.6/dist-packages/PIL/Image.pyt   split  s    
 &c         C   s   d S(   s   Return current frame numberi    (    (   R   (    (    s3   /usr/local/lib/python2.6/dist-packages/PIL/Image.pyt   tell  s    c         C   s>  |  i  \ } } | | d j o) t | | d | d  } | d } n | | d j o) t | | d | d  } | d } n | | f } | |  i  j o d S|  i d |  |  i   y |  i | |  } Wn9 t j
 o- | t j o   n |  i | t  } n X| i	 |  _	 | i
 |  _
 | |  _  d |  _ d S(   s9   Create thumbnail representation (modifies image in place)i    i   N(   R8   R   R   R;   R   R
  R   R  R  R   R:   R   (   R   R8   R  R   R   R   (    (    s3   /usr/local/lib/python2.6/dist-packages/PIL/Image.pyt	   thumbnail  s,        
	i   c   	      C   s   t  | t  o | i | |  d | d | St | d  o | i   \ } } n | d j o t d   n t |  i | d  } | t	 j o7 xT | D]( \ } } | i
 | |  t | | |  q Wn! | i
 d | |  | | | |  | S(   s   Transform imageR  t   fillR   s   missing method datai    N(   i    i    (   R   t   ImageTransformHandlerR  R   R   R;   R   R   R:   t   MESHt   _Image__transformert   QUAD(	   R   R8   R   Ry   R  R5  R   R   t   quad(    (    s3   /usr/local/lib/python2.6/dist-packages/PIL/Image.pyR  ?  s     $ c         C   s  | d | d } | d | d } | t  j o4 | d | d | d | d | d | d f } n| t j ol | \ }	 }
 } } t | |	  | } t | |
  | } t  } |	 | d | d |
 | d d | f } nO| t j oB | d | d | d | d | d | d | d | d f } n | t j o | d d !} | d d !} | d d !} | d d	 !} | \ }	 }
 d
 | } d
 | } |	 | d |	 | | d |	 | | d | d | d |	 | | |
 | d |
 | | d |
 | | d | d | d |
 | | f } n t d   | t t t f j o t d   n | i	   |  i	   | i
 d j o
 t } n |  i i | | i | | | |  d  S(   Ni   i    i   i   i   i   i   i   i   g      ?s   unknown transformation methods   unknown resampling filterR   R    (   R   R    (   R  t   EXTENTt   floatt   PERSPECTIVER9  R   R  R  R  R   R:   R   t
   transform2(   R   R   R   R   Ry   R  R5  R  R0   t   x0t   y0t   x1t   y1t   xst   yst   nwt   swt   set   net   Ast   At(    (    s3   /usr/local/lib/python2.6/dist-packages/PIL/Image.pyt   __transformerS  sF    ,    
 
!#!-


c         C   s)   |  i    |  i i |  } |  i |  S(   s3   Transpose image (flip or rotate in 90 degree steps)(   R   R   t	   transposeR   (   R   R   R   (    (    s3   /usr/local/lib/python2.6/dist-packages/PIL/Image.pyRL    s    
N(6   R   R   R;   R   t   format_descriptionRz   R   R   R   R   R   R   R   R   R   R   R   t   WEBR   R   R   R   R   R   RV   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R  R   R  R  R
  R  R   R-  R1  R2  R3  R4  R  R8  RL  (    (    (    s3   /usr/local/lib/python2.6/dist-packages/PIL/Image.pyR     sd   					%		$	+ 										1; 	: 	)EA			95R   c           B   s   e  Z d    Z d   Z RS(   c         C   s   t  i |   | \ } } } } | | j  o
 | } n | | j  o
 | } n | i |  _ | | | | f |  _ | | | | f |  _ | i |  _ d  S(   N(   R   Rz   R:   R8   t   _ImageCrop__cropR   (   R   R   R   R?  R@  RA  RB  (    (    s3   /usr/local/lib/python2.6/dist-packages/PIL/Image.pyRz     s    

c         C   sQ   |  i  o% |  i i |  i   |  _ d  |  _  n |  i o |  i i |  i  Sd  S(   N(   RO  R   R   R;   R   R   (   R   (    (    s3   /usr/local/lib/python2.6/dist-packages/PIL/Image.pyR     s
    

(   R   R   Rz   R   (    (    (    s3   /usr/local/lib/python2.6/dist-packages/PIL/Image.pyR     s   	R   c           B   s   e  Z RS(    (   R   R   (    (    (    s3   /usr/local/lib/python2.6/dist-packages/PIL/Image.pyR     s   R6  c           B   s   e  Z RS(    (   R   R   (    (    (    s3   /usr/local/lib/python2.6/dist-packages/PIL/Image.pyR6    s   c           C   s   t    i t i d   S(   s+   Create greyscale wedge (for debugging only)R   (   R   R   Rl   t   wedge(    (    (    s3   /usr/local/lib/python2.6/dist-packages/PIL/Image.pyt   _wedge  s    c         C   sx   | d j o t   i t i |  |   St |  o" d d k } | i | |   } n t   i t i |  | |   S(   s   Create a new imageiN(	   R;   R   R   Rl   R   R   R   R   R5  (   R:   R8   t   colorR   (    (    s3   /usr/local/lib/python2.6/dist-packages/PIL/Image.pyR     s    R   c         G   s|   t  |  d j o t | d  o | d } n | d j o | d j o
 |  } n t |  |  } | i | | |  | S(   s   Load image from stringi   i    R   (    (   RH   R   R   R   (   R:   R8   Ry   Rp   Rq   R   (    (    s3   /usr/local/lib/python2.6/dist-packages/PIL/Image.pyR     s    $
c         G   s   t  |  d j o t | d  o | d } n | d j o | d j o4 t o t i d t d d n |  d d f } n | d t j oD t |  d	  } | i t i	 | | | d
 d |   } d | _ | Sn t |  | | | |  S(   s    Load image from string or bufferi   i    R   s   the frombuffer defaults may change in a future release; for portability, change the call to read:
  frombuffer(mode, size, data, 'raw', mode, 0, 1)R   i   i(    (   i   i   N(   RH   R   R   R   t   RuntimeWarningt	   _MAPMODESR   R   Rl   t
   map_bufferR;   R   R   (   R:   R8   Ry   Rp   Rq   R   (    (    s3   /usr/local/lib/python2.6/dist-packages/PIL/Image.pyt
   frombuffer)  s     $!		c   
      C   sL  |  i  } | d } t |  } y | d } Wn t j
 o d  } n X| d  j oR y, d | d | d f } t | \ } } Wq t j
 o t d   q Xn | } | d j o
 d } n | d j o
 d } n d } | | j o t d   n | d | d f }	 | d  j	 o |  i   }  n t | |	 |  d | d d  S(   NR<   t   stridesi   i   R   s   Cannot handle this data typeR   R   R   R    R   R   i   i   s   Too many dimensions.i    R   (   i   i   (   R   R   R   R    R   (	   R   RH   R   R;   t   _fromarray_typemapR   R   R   RV  (
   t   objR:   t   arrR<   t   ndimRW  t   typekeyR   t   ndmaxR8   (    (    s3   /usr/local/lib/python2.6/dist-packages/PIL/Image.pyt	   fromarrayP  s2    	


s   I;8s   |i1s   <i2s   >i2s   I;32s   <i4s   I;32Bs   >i4s   F;32Fs   <f4s   F;32BFs   >f4s   F;64Fs   <f8s   F;64BFs   >f8t   rc         C   st  | d j o t  d   n t |   o( d d k } |  } | i |  d  }  n d } |  i d  } t   xq t D]i } yD t | \ } } | p | |  o |  i d  | |  |  SWqu t	 t
 t f j
 o qu Xqu Wt   ox xu t D]i } yD t | \ } } | p | |  o |  i d  | |  |  SWq t	 t
 t f j
 o q Xq Wn t d	   d S(
   s3   Open an image file, without loading the raster dataR_  s   bad modeiNt   rbR   i   i    s   cannot identify image file(   R   R   R#  R$  t   readRP   t   IDRa   R-  t   SyntaxErrort
   IndexErrorR   Ri   Ro   (   R&  R:   R#  R(  t   prefixR   t   factoryt   accept(    (    s3   /usr/local/lib/python2.6/dist-packages/PIL/Image.pyR$    s:     	
 c         C   s6   |  i    | i    |  i t i |  i | i |   S(   s   Interpolate between images.(   R   R   Rl   t   blendR   (   t   im1t   im2R   (    (    s3   /usr/local/lib/python2.6/dist-packages/PIL/Image.pyRh    s    

c         C   s#   | i    } | i |  d |  | S(   sC   Create composite image by blending images using a transparency maskN(   R   R   R;   (   t   image1t   image2R   R   (    (    s3   /usr/local/lib/python2.6/dist-packages/PIL/Image.pyt	   composite  s    c         G   s   |  i  | d  S(   s   Evaluate image expressioni    (   R   (   R   Rq   (    (    s3   /usr/local/lib/python2.6/dist-packages/PIL/Image.pyt   eval  s    c         C   s  t  |   t |  j p d |  j o t d   n x_ | d D]S } | i t |   j o t d   n | i | d i j o t d   qA qA Wt i |  | d i  } x? t t  |    D]+ } | | i	   | i
 | | i |  q W| d i |  S(   s=   Merge a set of single band images into a new multiband image.t   *s   wrong number of bandsi   s   mode mismatchi    s   size mismatch(   RI   RH   R   R:   RE   R8   Rl   R   R   R   R   R   R   (   R:   RF   R   R   (    (    s3   /usr/local/lib/python2.6/dist-packages/PIL/Image.pyR     s    &  c         C   s0   t  i |   }  t i |   | | f t |  <d  S(   N(   R   R"  Rb  R   Ra   (   R   Rf  Rg  (    (    s3   /usr/local/lib/python2.6/dist-packages/PIL/Image.pyt   register_open"  s    c         C   s   | t  t i |   <d  S(   N(   t   MIMER   R"  (   R   t   mimetype(    (    s3   /usr/local/lib/python2.6/dist-packages/PIL/Image.pyt   register_mime.  s    c         C   s   | t  t i |   <d  S(   N(   Rb   R   R"  (   R   t   driver(    (    s3   /usr/local/lib/python2.6/dist-packages/PIL/Image.pyt   register_save8  s    c         C   s    t  i |   t t  i |  <d  S(   N(   R   R"  R!  R   (   R   t	   extension(    (    s3   /usr/local/lib/python2.6/dist-packages/PIL/Image.pyt   register_extensionB  s    c         K   s   t  t |  f |  d  S(   N(   Rm   t   _showxv(   R   t   options(    (    s3   /usr/local/lib/python2.6/dist-packages/PIL/Image.pyR0  I  s    c         K   s)   d d  k  } t | i |  | f |  d  S(   Ni(   t	   ImageShowRm   R1  (   R   R.  Ry  Rz  (    (    s3   /usr/local/lib/python2.6/dist-packages/PIL/Image.pyRx  M  s    (k   t   VERSIONR   R   R;   R    R\   t   _imagingRl   R   t   strR   RS  R@   R   R   R   RR   t   typesR   R	   R
   t   typet   unicodeR   R   RU   R   R   R   t   operatorR   R   R_   t   NONEt   FLIP_LEFT_RIGHTt   FLIP_TOP_BOTTOMt	   ROTATE_90t
   ROTATE_180t
   ROTATE_270R  R;  R=  R9  R7  R  R  t   LINEARR  t   CUBICR  t   ORDEREDt	   RASTERIZER   RN  R   R   t   SEQUENCEt	   CONTAINERRb  Ra   Rq  Rb   R!  t	   _MODEINFOt	   byteorderRn   t   structt   unpackt   _ENDIANR9   R?   t   keyst   MODESt   sortRT  RC   RE   RG   RI   RJ   RP   Ri   Rs   Rw   Rx   R   R   R   R   R6  RQ  R   R   RV  R^  RX  R$  Rh  Rm  Rn  R   Rp  Rs  Ru  Rw  R0  Rx  (    (    (    s3   /usr/local/lib/python2.6/dist-packages/PIL/Image.pyt   <module>   s,  	$			



		
			
		&	+	    #
	$/'   <					
	
		