ó <×ï[c@sDddlmZddlmZmZddlZddlZddlZd„Zddddd d gZ d „Z d „Z d ejfd„ƒYZ dd„Zd„Zd„Zd„Zeje je ƒeje jeƒedkr@eejƒdkredƒejƒnejdZe eƒsKedƒejƒnejeƒZedeeƒƒedeejƒƒedeejƒƒedeejƒƒedddƒeej ƒƒeejƒdkr@ejdZ!ej"ej#ƒZedej$j%eƒe!fƒej&e!e jƒq@ndS(iÿÿÿÿ(tprint_function(tImaget ImageFileNcCsGy(t|ƒ}||dkr#dSdSWnttfk rBdSXdS(Nii(tintt ValueErrort OverflowError(tfti((s5/tmp/pip-build-SKekGm/pillow/PIL/SpiderImagePlugin.pytisInt,s iiiõÿÿÿiôÿÿÿiëÿÿÿiêÿÿÿcCs¬d |}x7dddddddgD]}t||ƒs&d Sq&Wt|dƒ}|tkrdd St|dƒ}t|dƒ}t|dƒ}|||kr¨d S|S( Niciiii i iii(ic(RRtiforms(ttthRtiformtlabrectlabbyttlenbyt((s5/tmp/pip-build-SKekGm/pillow/PIL/SpiderImagePlugin.pytisSpiderHeader?s " cCsvt|dƒ}|jdƒ}WdQXtjd|ƒ}t|ƒ}|dkrrtjd|ƒ}t|ƒ}n|S(Ntrbi\s>23fis<23f(topentreadtstructtunpackR(tfilenametfpRR thdrlen((s5/tmp/pip-build-SKekGm/pillow/PIL/SpiderImagePlugin.pyt isSpiderImageSs  tSpiderImageFilecBsheZdZdZeZd„Zed„ƒZed„ƒZ d„Z d„Z dd„Z d „Z RS( tSPIDERsSpider 2D imagecCsd}|jj|ƒ}y|d|_tjd|ƒ}t|ƒ}|dkrxd|_tjd|ƒ}t|ƒ}n|dkr“tdƒ‚nWn tjk r¶tdƒ‚nXd|}t|d ƒ}|dkrìtd ƒ‚nt|d ƒt|d ƒf|_ t|d ƒ|_ t|dƒ|_ |j dkre|j dkre|}d|_ n¸|j dkrÚ|j dkrÚt|d ƒt|d ƒd|_ ||_t|dƒ|_ |d }d|_ nC|j dkr|j dkr||j}d |_ n tdƒ‚|jr2d|_n d|_d|_dd|j||jddffg|_|j|_dS(Niiis>27fis<27fsnot a valid Spider fileicisnot a Spider 2D imagei iiis inconsistent stack header valuessF;32BFsF;32FtFtrawil(ic(ii(RRt bigendianRRRt SyntaxErrorterrorRt_sizetistackt imgnumbert_nimagestimgbytesRt stkoffsettrawmodetmodetsizettilet_SpiderImageFile__fp(tselftnRR RR R toffset((s5/tmp/pip-build-SKekGm/pillow/PIL/SpiderImagePlugin.pyt_opendsR       # %          cCs|jS(N(R$(R,((s5/tmp/pip-build-SKekGm/pillow/PIL/SpiderImagePlugin.pytn_framesscCs |jdkS(Ni(R$(R,((s5/tmp/pip-build-SKekGm/pillow/PIL/SpiderImagePlugin.pyt is_animated¡scCs"|jdkrdS|jdSdS(Nii(R#(R,((s5/tmp/pip-build-SKekGm/pillow/PIL/SpiderImagePlugin.pyttell¦scCs||jdkrtdƒ‚n|j|ƒs1dS|j||j|j|_|j|_|jj|jƒ|j ƒdS(Nis#attempt to seek in a non-stack file( R"tEOFErrort _seek_checkRR%R&R+RtseekR/(R,tframe((s5/tmp/pip-build-SKekGm/pillow/PIL/SpiderImagePlugin.pyR5¬s iÿcCs_|jƒ\}}d}||kr5|||}n| |}|j||d„ƒjdƒS(NicSs |||S(N((Rtmtb((s5/tmp/pip-build-SKekGm/pillow/PIL/SpiderImagePlugin.pyt½stL(t getextrematpointtconvert(R,tdepthtminimumtmaximumR7R8((s5/tmp/pip-build-SKekGm/pillow/PIL/SpiderImagePlugin.pyt convert2byte·s   cCs)ddlm}|j|jƒddƒS(Niÿÿÿÿ(tImageTktpalettei(tPILRBt PhotoImageRA(R,RB((s5/tmp/pip-build-SKekGm/pillow/PIL/SpiderImagePlugin.pyt tkPhotoImageÀs(t__name__t __module__tformattformat_descriptiontFalset!_close_exclusive_fp_after_loadingR/tpropertyR0R1R2R5RARF(((s5/tmp/pip-build-SKekGm/pillow/PIL/SpiderImagePlugin.pyR^s 9  cCsÀ|dkst|ƒdkr"dSg}x‘|D]‰}tjj|ƒs[td|ƒq/nytj|ƒjƒ}Wn't |ƒs/t|dƒq/q/nX||j d<|j |ƒq/W|S(s0create a list of Image.images for use in montageiNsunable to find %ss is not a Spider image fileR( tNonetlentostpathtexiststprintRRRARtinfotappend(tfilelisttimglisttimgtim((s5/tmp/pip-build-SKekGm/pillow/PIL/SpiderImagePlugin.pytloadImageSeriesÉs    c CsI|j\}}|d}d|}d|dkr@|d7}n||}g}t|dƒ}x!t|ƒD]}|jdƒqmWt|ƒdkršgSd|d$sJ      k  "