Ñò
µSJc           @   sĉ   d  d k  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 xe e i d D]R Z	 e i e	  \ Z
 Z e d j o! d	 e	 e
 e d e d f GHq d
 e	 GHq Wn d S(   i˙˙˙˙Nc         C   sg   |  d d j o
 d  n t  i d |   } | p d Sd t | i d   t | i d   f f S(	   Ni    t   #s%   I don't support comment in a PPM files   ^(\d+)\s(\d+)t   PPMi   i   (   NN(   t   ret   searcht   Nonet   intt   group(   t   ht   m(    (    sU   /mnt/luc/web/www.saillard.org/www/programs_and_patches/photon/photon.hg/Photon/PxM.pyt   identify_P6   s    
c         C   sa   d  } t |  d  } | p d S| i d  } | i   | d d !d j o t | d  Sd S(   Nt   rbi   i    i   s   P6
(   NN(   NN(   R   t   opent   readt   closeR	   (   t   filenameR   t   f(    (    sU   /mnt/luc/web/www.saillard.org/www/programs_and_patches/photon/photon.hg/Photon/PxM.pyt   identify   s    
t   __main__i   s   Usage: %s files...
i    i   s   %s (format=%s; size = %d,%d)s   %s is not a PPM,PGM,PBM file(   R   R	   R   t   __name__t   syst   PxMt   lent   argvt   exitR   t   formatt   infoR   (    (    (    sU   /mnt/luc/web/www.saillard.org/www/programs_and_patches/photon/photon.hg/Photon/PxM.pyt   <module>	   s   		 !
