
SJc        	   @   s   d  d  Z  d   Z d   Z e d j o d d k Z d d k Z e e i  d j  o! d e i d	 GHe i d	  n x\ e i d
 D]I Z	 e i e	  Z
 e
 d j o d e	 e
 d	 e
 d
 f GHq d e	 GHq Wn d S(   i   c         C   s=   d  } t |  d  } | o | i |  } | i   n | S(   Nt   rb(   t   Nonet   opent   readt   close(   t   filenamet   sizet   ht   f(    (    sV   /mnt/luc/web/www.saillard.org/www/programs_and_patches/photon/photon.hg/Photon/JPEG.pyt   read_headers   s    c         C   s   d } x t  o yL t |  |  } | d  j o d  S| d d !d j o t | d  Sd  SWq	 t j
 o7 } | d } d G| GH| d j o d |  GHd  Sq	 Xq	 Wd  S(   Ni   i    i   s   s   Jpeg Resize and reload header i   s+   Can't identify this file as an JPEG file %s(   t   TrueR	   R   t   find_marker_SOFxt
   IndexError(   R   R   R   t   err(    (    sV   /mnt/luc/web/www.saillard.org/www/programs_and_patches/photon/photon.hg/Photon/JPEG.pyt   identify   s      
		c         C   s(  d } x|  | d j o d  S| d 7} x  |  | d j o | d 7} q, W|  | d j o |  | d j o |  | d j on |  | d j o] | d 7} t |  | d	  d
 >t |  | d  Bt |  | d  d
 >t |  | d  Bf S| d 7} | t |  |  d
 >t |  | d  B7} q	 d  S(   Ni    s   i   i   s   s   s   s   i   i   i   i   i   (   R   t   ord(   R   t   i(    (    sV   /mnt/luc/web/www.saillard.org/www/programs_and_patches/photon/photon.hg/Photon/JPEG.pyR   %   s    
 D
S
t   __main__iNi   s   Usage: %s files...
i    i   s   %s (size = %d,%d)s   %s is not a Jpeg file(   R	   R   R   t   __name__t   syst   JPEGt   lent   argvt   exitR   t   infoR   (    (    (    sV   /mnt/luc/web/www.saillard.org/www/programs_and_patches/photon/photon.hg/Photon/JPEG.pyt   <module>   s   			 
