ó <×ï[c@sdddlmZmZddlmZmZmZddlm Z ddl Z ddl Z dZ d„Z idd6dd6d d6d d 6d d!6d d"6dd#6dd$6Zdejfd„ƒYZd„Zdejfd„ƒYZejdeƒejejee ƒejejeƒejejdƒejejdƒejejddddgƒdS(%i(tImaget ImageFile(ti8to8ti16be(tpy3iÿÿÿÿNs0.3cCs"t|ƒdko!t|ƒdkS(NiiÚ(tlenti16(tprefix((s2/tmp/pip-build-SKekGm/pillow/PIL/SgiImagePlugin.pyt_accept#stLisL;16BtRGBisRGB;16BtRGBAisRGBA;16Bt SgiImageFilecBseZdZdZd„ZRS(tSGIsSGI Image File FormatcCsd}|jj|ƒ}t|ƒdkr9tdƒ‚nt|dƒ}t|dƒ}t|dƒ}t|dƒ}t|dƒ}t|d ƒ}|||f} d } yt| } Wntk rÏnX| d krëtd ƒ‚n||f|_| jd ƒd |_ d} |d krÆ|||} |dkrjdd|j ||j d | ffg|_ qýg|_ |} x|j D]<}|j j dd|j | |d | ffƒ| | 7} qƒWn7|dkrýdd|j || | |ffg|_ ndS(NiiÚsNot an SGI image fileiiiiii tsUnsupported SGI image modet;iiÿÿÿÿtSGI16trawitsgi_rle(ii(ii(ii( tfptreadRt ValueErrorRtMODEStKeyErrort_sizetsplittmodetsizettiletappend(tselftheadlentst compressiontbpct dimensiontxsizetysizetzsizetlayouttrawmodet orientationtpagesizetoffsettlayer((s2/tmp/pip-build-SKekGm/pillow/PIL/SgiImagePlugin.pyt_open:sH     !     (t__name__t __module__tformattformat_descriptionR.(((s2/tmp/pip-build-SKekGm/pillow/PIL/SgiImagePlugin.pyR 5scCsB|jdkr<|jdkr<|jdkr<tdƒ‚n|j}|jddƒ}|dkrrtdƒ‚nd }d }d }d }|j\} } |jdkr½| dkr½d}n|jdkrÕd}nt|jƒ} |dksü|dkrd} nt|jƒƒ| krBtd | t|jƒƒfƒ‚nd } d} tjj tjj |ƒƒd }t r‹|j ddƒ}nd }|j tjd|ƒƒ|j t|ƒƒ|j t|ƒƒ|j tjd|ƒƒ|j tjd| ƒƒ|j tjd| ƒƒ|j tjd| ƒƒ|j tjd| ƒƒ|j tjd| ƒƒ|j tjddƒƒ|j tjd|ƒƒ|j tjddƒƒ|j tjd|ƒƒ|j tjddƒƒd}|dkrþd}nx3|jƒD]%}|j |jd|d |ƒƒq W|jƒdS(NR R R sUnsupported SGI image modeR#iis%Unsupported number of bytes per pixeliÿÿÿÿiÚiis0incorrect number of bands in SGI write: %s vs %siÿtasciitignores>hs>Hs>lt4sRt79sR!t404ssL;16BR(ii(RRt encoderinfotgetRRtgetbandstostpathtsplitexttbasenameRtencodetwritetstructtpackRRttobytestclose(timRtfilenametinfoR#R*t magicNumbertrletdimtxtytztpinmintpinmaxtimgNametcolormapR)tchannel((s2/tmp/pip-build-SKekGm/pillow/PIL/SgiImagePlugin.pyt_save|s^-     "  #t SGI16DecodercBseZeZd„ZRS(c CsÅ|j\}}}|jj|jj}t|jƒ}|jjdƒxwt|ƒD]i}t j d|jj|jjfƒ}|j |jj d|ƒdd||ƒ|j j|j |ƒqTWdS( NiR iRsL;16Biÿÿÿÿi(iÿÿÿÿi(targststateR%R&RRtfdtseektrangeRtnewt frombytesRREtputband( RtbufferR)tstrideR*R+R'tbandRR((s2/tmp/pip-build-SKekGm/pillow/PIL/SgiImagePlugin.pytdecodeÉs$ (R/R0tTruet _pulls_fdR`(((s2/tmp/pip-build-SKekGm/pillow/PIL/SgiImagePlugin.pyRTÆsRs image/sgis image/rgbs.bws.rgbs.rgbas.sgi(iii(iii(iii(iii(iii(iii(iii(iii(RRRt_binaryRRRRt_utilRRAR;t __version__R RR RSt PyDecoderRTtregister_decodert register_openR1t register_savet register_mimetregister_extensions(((s2/tmp/pip-build-SKekGm/pillow/PIL/SgiImagePlugin.pyts2    G J