Warning: session_start(): Session cannot be started after headers have already been sent in /home/tvrreohg/public_html/manga.php on line 13
3 iaR @sddlZddlZddlZddlZddlmZddlmZdZd%Z dZ d&dd'd d(d d)dd*diZ ddZ ddZ ddZGdddejZGdddeZGdddZd+ddZdd ZGd!d"d"ZGd#d$d$ZdS),N)Image)isPathiiFzimage buffer overrun errorzdecoding errorz unknown errorzbad configuration zout of memory errorc CsNytjj|}Wntk r.tj|}YnX|s>d|}t|ddS)Nzdecoder error z when reading image file)rcoreZgetcodecstatusAttributeErrorERRORSgetOSError)errormessager./tmp/tmp5hum_rxs/lib64/python/PIL/ImageFile.py raise_oserror<s rcCstjdtt|S)Nzdraise_ioerror is deprecated and will be removed in Pillow 9 (2022-01-02). Use raise_oserror instead.)warningswarnDeprecationWarningr)rrrr raise_ioerrorFsrcCs|dS)Nrr)trrr _tilesortOsrcsReZdZdZdfdd ZddZddZd d Zd d Zd dZ ddZ Z S) ImageFilez*Base class for image file format handlers.Ncstjd|_d|_d|_d|_f|_t|_t |rPt |d|_ ||_ d|_ n||_ ||_ d|_ yhy |jWn8tttttjfk r}zt||WYdd}~XnX|j s|jddkrtdWn&tk r|j r|j jYnXdS)NrrrbTznot identified by this driver)super__init__ _min_framecustom_mimetypetilereadonly decoderconfigMAXBLOCKdecodermaxblockropenfpfilename _exclusive_fp_open IndexError TypeErrorKeyErrorEOFErrorstructr SyntaxErrormodesize BaseExceptionclose)selfr%r&v) __class__rrr\s<     zImageFile.__init__cCs,|jr |jS|jdk r(tjj|jjSdS)N)rformatrZMIMEr upper)r3rrrget_format_mimetypes zImageFile.get_format_mimetypecCs|jr|jjd|_dS)zCheck file integrityN)r'r%r2)r3rrrverifys zImageFile.verifyc>CsX|jdkrtdtjj|}|js(|Sd|_|jo@t|jdk}|oPttd }d}y|j }d}Wnt k r|j j }YnXy|j }d}Wnt k r|j j}YnX|r|jd\}}}} |dkot| dko| d|jko| dtjkryhddl} t|j} | j| jd| jd |_WdQRXtjj|j|j||| |_d}|jr^d|j_Wn"t ttfk rd|_YnX|jd} |js|jjtd y |j} Wnt k rd } YnXx$|jD]\}}}} tj |j|| |j!}z|||j"|j||j#r4|j$|j |j%d \}} n| }xy||j&}Wn>t't(j)fk r}zt*rlPn td |WYdd}~XnX|st*rPntd t|d||}|j%|\}} |dkrP||d}q:WWd|j+XqWg|_||_,|j-|j.r"|j/r"|j j0d|_ |j rLt* rL| dkrLt1| tjj|S)z"Load image data based on tile listNzcannot load this imagerpypy_version_inforFrawr)access)keyzimage file is truncatedzimage file is truncated (z bytes not processed))2rr rloadmapr&lenhasattrsys load_readr r%read load_seekseekr/Z _MAPMODESmmapr$filenoZ ACCESS_READr Z map_bufferr0imZpaletteZdirty ImportError load_preparesortrZ tile_prefix _getdecoderr!setimagepulls_fdsetfddecoder#r)r-rLOAD_TRUNCATED_IMAGEScleanupr load_endr'Z!_close_exclusive_fp_after_loadingr2r)r3ZpixelZuse_mmapr rFrHZ decoder_nameextentsoffsetargsrIr%Zerr_codeprefixdecoderstatusbsenrrrr@s    "       zImageFile.loadcCsR|j s$|jj|jks$|jj|jkr8tjj|j|j|_|jdkrNtjj|dS)NP)rKr/r0rr newr@)r3rrrrMs$ zImageFile.load_preparecCsdS)Nr)r3rrrrVszImageFile.load_endcCsD||jks0t|do|jdk r8||j|jkr8td|j|kS)N _n_framesz attempt to seek outside sequence)rrCrcZn_framesr,tell)r3framerrr _seek_check*s  zImageFile._seek_check)NN) __name__ __module__ __qualname____doc__rr8r9r@rMrVrf __classcell__rr)r5rrYs/ | rc@s(eZdZdZddZddZddZdS) StubImageFilez Base class for stub image loaders. A stub loader is an image loader that can identify files of a certain format, but relies on external code to load the file. cCs tddS)Nz+StubImageFile subclass must implement _open)NotImplementedError)r3rrrr(AszStubImageFile._opencCsL|j}|dkr"td|jd|j|}|dk s8t|j|_|j|_dS)Nzcannot find loader for this z file)_loadr r6r@AssertionErrorr5__dict__)r3loaderimagerrrr@Ds  zStubImageFile.loadcCs tddS)z (Hook) Find actual image loader.z+StubImageFile subclass must implement _loadN)rm)r3rrrrnNszStubImageFile._loadN)rgrhrirjr(r@rnrrrrrl9s rlc@sPeZdZdZdZdZdZdZdZdZ ddZ ddZ dd Z d d Z d d ZdS)Parserzj Incremental image parser. This class implements the standard feed/close consumer interface. NrcCs|jdkstddS)z (Consumer) Reset the parser. Note that you can only call this method immediately after you've created a parser; parser instances cannot be reused. Nzcannot reuse parsers)dataro)r3rrrreset`sz Parser.resetc Cs|jr dS|jdkr||_n |j||_|jr|jdkr|tt|j|j}|j|d|_|j||_|jdksx|j r|dS|jj|j\}}|dkrd|_d|_|dkrd|_t|ndS|j|d|_n|jrny&t j |j}t j |}WdQRXWnt k rYnXt|dp*t|d}|sBt|jdkrJd|_nv|j|jd\}}} } g|_t j|j|| |j|_|jj|j|| |_|jt|jkr|j|jd|_d|_||_dS)z (Consumer) Feed data to the parser. :param data: A string buffer. :exception OSError: If the parser failed to parse the image file. NrrrGrE)finishedrtr[rXminrBrSrrrioBytesIOrr$r rCrrMrOr/r!rPrK) r3rtskipr`r_r%rKflagdoarrrfeedhsR      z Parser.feedcCs|S)Nr)r3rrr __enter__szParser.__enter__cGs |jdS)N)r2)r3rYrrr__exit__szParser.__exit__cCsz|jr*|jdd|_|_|js*td|js8td|jrttj|j$}ztj ||_Wd|jj XWdQRX|jS)a (Consumer) Close the stream. :returns: An image object. :exception OSError: If the parser failed to parse the image file either because it cannot be identified or cannot be decoded. r>Nzimage was incompletezcannot parse this image) r[rrtrvr rrrxryrr$r@)r3r%rrrr2s   z Parser.close)rgrhrirjZ incrementalrrrtr[rXrvrurrrr2rrrrrsSsPrscCs.|jt|dsf|_|jtdtt||jdd}y|tj kpP|tj j k}Wnt t fk rpd}YnX|r|j dSy|j}|j Wnt tjfk rx}zx|D]\}}} } tj|j|| |j}| dkr|j| |j|j||jr|j||j\} } n*x(|j|\} } } |j| | rPqW| dkr\t d| d||jqWWYdd}~XnXx|D]\}}} } tj|j|| |j}| dkr|j| |j|j||jr|j||j\} } n |j||} | dkrt d| d|jqWt|d r*|j dS) zHelper to save image based on tile list :param im: Image object. :param fp: File object. :param tile: Tile list. :param bufsize: Optional buffer size encoderconfig)r=rFNzencoder error z when writing image fileflush)r@rCrrNrmaxr"r0rDstdoutbufferr r rrJrxUnsupportedOperationrZ _getencoderr/rHrPrKZ pushes_fdrRZencode_to_pyfdencodewriterUZencode_to_file)rKr%rbufsizerZfhexcr_r]r}r~lr^r|rrr_saves\               rcCs|dkr dS|tkr6|j|}t||kr2td|Sg}x8|dkrr|jt|t}|sZP|j||t|8}qread method. :param size: Number of bytes to read. :returns: A string containing size bytes of data. Raises an OSError if the file is truncated and the read cannot be completed rr>zTruncated File Readcss|]}t|VqdS)N)rB).0r|rrr ;sz_safe_read..) SAFEBLOCKrFrBr rwappendsumjoin)r%r0rtblockrrr _safe_read s"     rc@seZdZddZddZdS) PyCodecStatecCsd|_d|_d|_d|_dS)Nr)xsizeysizexoffyoff)r3rrrrAszPyCodecState.__init__cCs |j|j|j|j|j|jfS)N)rrrr)r3rrrrWGszPyCodecState.extentsN)rgrhrirrWrrrrr@src@s\eZdZdZdZddZddZeddZd d Z d d Z d dZ dddZ dddZ dS) PyDecoderz Python implementation of a format decoder. Override this class and add the decoding logic in the :meth:`decode` method. See :ref:`Writing Your Own File Decoder in Python` FcGs(d|_t|_d|_||_|j|dS)N)rKrstatefdr/init)r3r/rYrrrrUs zPyDecoder.__init__cCs ||_dS)z Override to perform decoder specific initialization :param args: Array of args items from the tile entry :returns: None N)rY)r3rYrrrr\szPyDecoder.initcCs|jS)N) _pulls_fd)r3rrrrQeszPyDecoder.pulls_fdcCs tdS)a= Override to perform the decoding process. :param buffer: A bytes object with the data to be decoded. :returns: A tuple of ``(bytes consumed, errcode)``. If finished with decoding return <0 for the bytes consumed. Err codes are from :data:`.ImageFile.ERRORS`. N)rm)r3rrrrrSis zPyDecoder.decodecCsdS)zV Override to perform decoder specific cleanup :returns: None Nr)r3rrrrUtszPyDecoder.cleanupcCs ||_dS)z Called from ImageFile to set the python file-like object :param fd: A python file-like object :returns: None N)r)r3rrrrrR|szPyDecoder.setfdNcCs||_|r|\}}}}n d\}}}}|dkrJ|dkrJ|jj\|j_|j_n(||j_||j_|||j_|||j_|jjdks|jjdkrtd|jj|jj|jjdks|jj|jj|jjdkrtddS)z Called from ImageFile to set the core output image for the decoder :param im: A core image object :param extents: a 4 tuple of (x0, y0, x1, y1) defining the rectangle for this tile :returns: None rzSize cannot be negativerz Tile cannot extend outside imageN)rrrr)rKr0rrrrr ValueError)r3rKrWZx0Zy0x1y1rrrrPs    zPyDecoder.setimagecCsd|s |j}tj|jd|}|j|j|jj|j|}|ddkrLtd|ddkr`tddS)a Convenience method to set the internal image from a stream of raw data :param data: Bytes to be set :param rawmode: The rawmode to be used for the decoder. If not specified, it will default to the mode of the image :returns: None r;rznot enough image datarzcannot decode image dataN) r/rrOrPrKrrWrSr)r3rtrawmoder|r^rrr set_as_raws    zPyDecoder.set_as_raw)N)N)rgrhrirjrrrpropertyrQrSrUrRrPrrrrrrKs   #rir?ii)r)rxr-rDrrZ_utilrr"rrTr rrrrrlrsrrrrrrrrs2      a B