*ec@sVddlmZdZddlZddlmZmZmZmZddl Z ej Z ej Z ej ZejdjZdZid>d?6d@dA6dBdC6dDdE6dFdG6dHdI6dJdK6dLdM6dNdO6dPdQ6dRdS6dTdU6dVdW6dXdY6dZd[6ZejdZd d\d!YZd"d]d#YZd$efd%YZd&Zd'ejfd(YZejZejZejZi d^d6d_d*6d`d 6dad 6dbd 6dcd6ddd6ded6dfd6dgd6dhd6did6djd6Zd6Z d7dkd8YZ!e d d9Z"d:Z#ej$d;eeej%d;e"ej&d;d<ej'd;d=dS(li(tprint_functions0.9N(tImaget ImageFilet ImagePalettet_binarys\w\w\w\wsPNG  t1iitLsL;2isL;4iitIsI;16BitRGBsRGB;16BtPsP;1isP;2sP;4tLAtRGBAsLA;16BisRGBA;16Bs^+*$t ChunkStreamcBsSeZdZdZdZdZdZdZdZddZ RS( cCs7||_g|_ttjds3|j|_ndS(Ntcrc32(tfptqueuethasattrRtcoretcrc_skiptcrc(tselfR((s8/usr/lib64/python2.7/site-packages/PIL/PngImagePlugin.pyt__init__Ps  cCs|jr<|jd\}}}|jd=|jj|n7|jjd}|d}|jj}t|}t|stdt|n|||fS(s.Fetch a new chunk. Returns header information.iiisbroken PNG file (chunk %s)( RRtseektreadttellti32tis_cidt SyntaxErrortrepr(Rtcidtpostlents((s8/usr/lib64/python2.7/site-packages/PIL/PngImagePlugin.pyRXs     cCsd|_|_|_dS(N(tNoneRRR(R((s8/usr/lib64/python2.7/site-packages/PIL/PngImagePlugin.pytclosejscCs|jj|||fdS(N(Rtappend(RRRR((s8/usr/lib64/python2.7/site-packages/PIL/PngImagePlugin.pytpushmscCsBtjrtd|||nt|d|jd||S(s"Call the appropriate chunk handlertSTREAMtchunk_tascii(RtDEBUGtprinttgetattrtdecode(RRRR((s8/usr/lib64/python2.7/site-packages/PIL/PngImagePlugin.pytcallqs cCsttjj|tjj|}t|jjdt|jjdf}||krptd|ndS(sRead and verify checksumis*broken PNG file(bad header checksum in %s)N(RRR ti16RRR(RRtdatatcrc1tcrc2((s8/usr/lib64/python2.7/site-packages/PIL/PngImagePlugin.pyRxs !0 cCs|jjddS(s3Read checksum. Used if the C module is not presentiN(RR(RRR.((s8/usr/lib64/python2.7/site-packages/PIL/PngImagePlugin.pyRstIENDcCshg}x[trc|j\}}}||kr4Pn|j|tj|j||j|q W|S(N(tTrueRRRt _safe_readRR#(RtendchunktcidsRRR((s8/usr/lib64/python2.7/site-packages/PIL/PngImagePlugin.pytverifys  ( t__name__t __module__RRR"R$R,RRR6(((s8/usr/lib64/python2.7/site-packages/PIL/PngImagePlugin.pyR Ns      tPngInfocBs&eZdZdZddZRS(cCs g|_dS(N(tchunks(R((s8/usr/lib64/python2.7/site-packages/PIL/PngImagePlugin.pyRscCs|jj||fdS(N(R:R#(RRR.((s8/usr/lib64/python2.7/site-packages/PIL/PngImagePlugin.pytaddsicCst|ts$|jdd}nt|tsH|jdd}n|r~ddl}|jd|d|j|n|jd|d|dS( Nslatin-1tstricttreplaceitzTXttttEXtt(t isinstancetbytestencodetzlibR;tcompress(RtkeytvaluetzipRE((s8/usr/lib64/python2.7/site-packages/PIL/PngImagePlugin.pytadd_texts $(R7R8RR;RJ(((s8/usr/lib64/python2.7/site-packages/PIL/PngImagePlugin.pyR9s  t PngStreamcBskeZdZdZdZdZdZdZdZdZ dZ d Z d Z RS( cCsJtj||i|_i|_d|_d|_d|_d|_dS(Ni(ii( R Rtim_infotim_texttim_sizeR!tim_modetim_tilet im_palette(RR((s8/usr/lib64/python2.7/site-packages/PIL/PngImagePlugin.pyRs     cCstj|j|}|jd}tjrXtd|| tdt||nt||}|dkrtd|nyt j ||d}Wnt j k rd}nX||j d<|S(NRAsiCCP profile namesCompression methodis+Unknown compression method %s in iCCP chunkit icc_profile(RR3RtfindRR(R)ti8RREt decompressterrorR!RL(RRRR tit comp_methodRR((s8/usr/lib64/python2.7/site-packages/PIL/PngImagePlugin.pyt chunk_iCCPs    cCstj|j|}t|t|df|_y4tt|dt|df\|_|_WnnXt|drd|j d}nd}|dkrSd}n0|dkrhd}n|dkr}d}nd}|dkrd ||f}qnd |jkr|jd }nd }d |jk|jjd d|jjdd|f|_yt|\} }Wn!tk r=td|nX|rH|S|jt||dt |j dt |j d|ddd|jdkrd|d} ||d|j j d| nd|jkr|jdkrnd|} t |jdtr*||d|jd| qtdtd|jd} d| d} ||d| | qp|jdkrtdtd|jd} ||dt| qp|jdkr|jd\}}}||dt|t|t|qptdnZ|jdkrp|j jdkrp|j j dd} d|} ||d| | n|jjd }|r||d!t t|dd"d#t t|dd"d#d$n|jjd%}|rx*|jD]\}}||||qWnd&|jkryddl}|j|jd&}|jjjd'|jjjd(|jjjd)|jjjd*ijd+d,jd-d.d/ }Wntk rd,}nX|d0tj|jd&}||d1|ntj|t||d2d4|j d| fg||d3d y|j WnnXdS(5NR tbitsiiiiiis%s;%dt dictionaryRptoptimizetcompress_levelit compress_typescannot write mode %s as PNGtIHDRiRAitPLTERRcttRNSisRis%cannot use transparency for this modeR tARitpHYsg F%u?g?stpnginfoRRtASCIItUnicodet MacintoshtentUSs ICC Profiletlatin1R=iOR?tiCCPRIR1(ii(!Rt encoderinfoRt encoderconfigt _OUTMODEStKeyErrortIOErrorRRxRRtimt getpaletteRBRCtmaxRRtgetpalettemodeRkR:Rt ICCProfilettagstdescRDt ImportErrorRERFRt_saveRtflush(RRtfilenameRtcheckRtnRRRt palette_bytest alpha_bytesRctalphatredtgreentblueRiRRR.Rtptname((s8/usr/lib64/python2.7/site-packages/PIL/PngImagePlugin.pyRs               # -$    n  2cKsVdddY}d}|}z ||_t||d|Wd|`X|jS(s4Return a list of PNG chunks representing this image.t collectorcBs eZgZdZdZRS(cSsdS(N((RR.((s8/usr/lib64/python2.7/site-packages/PIL/PngImagePlugin.pyRrscSs|jj|dS(N(R.R#(RR((s8/usr/lib64/python2.7/site-packages/PIL/PngImagePlugin.pyR#ts(R7R8R.RR#(((s8/usr/lib64/python2.7/site-packages/PIL/PngImagePlugin.pyRps cWsfdj|}tjj|tjj|\}}t|t|}|j|||fdS(NRp(RRRR RR#(RRR.RRR((s8/usr/lib64/python2.7/site-packages/PIL/PngImagePlugin.pyR#ws'N((RRR!R.(RtparamsRR#R((s8/usr/lib64/python2.7/site-packages/PIL/PngImagePlugin.pyt getchunksms   R|s.pngs image/png(RR(ii(RsL;2(ii(RsL;4(ii(RR(ii(RsI;16B(ii(sRGBsRGB(ii(sRGBsRGB;16B(ii(R sP;1(ii(R sP;2(ii(R sP;4(ii(R R (ii(R R (ii(sRGBAsLA;16B(ii(sRGBAsRGBA(ii(sRGBAsRGBA;16B(ii(((Rs(sL;1s(sL;2s(sL;4s(Rs(R s(sI;16Bs(sP;1s(sP;2s(sP;4s(R s(sRGBs(sRGBAs(((t __future__Rt __version__tretPILRRRRRERTti16beR-ti32beRtcompileReRRxR[RdR R9RKRzR{to8to16beRto32beRRRRRRt register_opent register_savetregister_extensiont register_mime(((s8/usr/lib64/python2.7/site-packages/PIL/PngImagePlugin.pyt"sp "     L p