)Eji  UddlmZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl Z ddl Z ddl Z ddlmZddlmZddlmZmZmZddlmZmZmZmZmZmZddlmZmZm Z dd l!m"Z"dd l#m$Z$m%Z%d e&d < dd l'm(Z(n #e)$rdZ(YnwxYwdZ*e*rddlm+Z+m,Z,m-Z-ddl.m/Z/ddlm0Z0m1Z1ej2e3Z4Gdde5Z6Gdde7Z8dZ9de&d<e:dZ;de&d< ddlme=ddkrde>e=dddeZ?e)e?nv#e)$rnZ@eAe@Bdre jCd e5n8eAe@Bd!re jCeAe@e5dZ@[@wwxYwGd"d#eZDGd$d%eZEGd&d'eZFeFjGd(eFjHd)eFjId)eFjJd*eFjKd+iZLGd,d-eZMGd.d/eZNGd0d1eZOe jPe3ZQeDeEeFeMeNeOfD]ZeD]ZReSeQeRjTeRjUeVe=d2r#e=jWZWe=jXZXe=jYZYe=jZZZe=j[Z[dZ*e*r(ddl\Z\dd3l]m^Z^dd4l_m`Z`dd5lmaZambZbmcZcmdZdmeZedd6lfmgZgmhZhmiZigZjd7e&d8<iZkd9e&d:<iZld;e&d<<iZmd=e&d><iZnd=e&d?<iZod;e&d@<iZpdAe&dB<iZqdCe&dD<e jrdEkrdFndGZsdndLZtgdMZudNZvdodQZwdodRZxdpdTZydqdVZzda{idWdXdYdXdZd[d\d]d^d]d_d]d`d]dadbdcdbdddbdedbdfdbdgdhdidhdjdkdldkdmdnidodpdqdrdsdtdudvdwdxdydxdzd{d|d{d}d~dd~ddddddddddddddiddddddddddddddddddddddddddddddddddidddddddddddddddddddddddddddddddddd“dddddƜZ|d;e&d<drdʄZ}dsd̄Z~dtd̈́Z dudvdՄZ dudwd؄ZGdلdڦZdxdބZGd߄deZGddIZGddejZGddejZdydZ dzd{dZ d|d}dZ d|d~dZGddeZeezezezZGddeZdddZddZddZddZidddgfddddgfdddgfd dd gfd dd gfd ddgfdddgfdddgfdddgfdddgfdddgfdddgfdddgfdddgfd dd!gfd"d#d#d$d%gfd&d'd'gd(fd)d*d*gd+fd,esd-fddgfd,esd.fddgfiZdd/Z ddd6Zdd9Zdd<Zdd@ZddCZddFZ dddLZddNZddQZddRZddTZddVZddWZdd[Zdd^Zdd`ZdddZddfZddgZddhZdddkZeeje=je*r ee:e0fZneZGdldmeZdS() annotationsN)MutableMapping)IntEnum)IOProtocolcast)ExifTags ImageModeTiffTagsUnidentifiedImageError __version___plugins)i32leo32beo32le) deprecate) DeferredErroris_pathzModuleType | None ElementTree)rF)CallableIteratorSequence) ModuleType)AnyLiteralceZdZdS)DecompressionBombWarningN__name__ __module__ __qualname__;C:\PYTHON\MyICR_Suite\python\Lib\site-packages\PIL/Image.pyrrKDr$rceZdZdS)DecompressionBombErrorNrr#r$r%r(r(Or&r$r(boolWARN_POSSIBLE_FORMATSiUUU int | NoneMAX_IMAGE_PIXELS)_imagingPILLOW_VERSIONzUThe _imaging extension was built for another version of Pillow or PIL: Core version: z Pillow version: zModule use of pythonz?The _imaging extension was built for another version of Python.zThe _imaging extensionc*eZdZdZdZdZdZdZdZdZ dS) Transposerr N) r r!r"FLIP_LEFT_RIGHTFLIP_TOP_BOTTOM ROTATE_90 ROTATE_180 ROTATE_270 TRANSPOSE TRANSVERSEr#r$r%r0r0s1OOIJJIJJJr$r0c"eZdZdZdZdZdZdZdS) Transformrr r1r2r3N)r r!r"AFFINEEXTENT PERSPECTIVEQUADMESHr#r$r%r>r>s' F FK D DDDr$r>c&eZdZdZdZdZdZdZdZdS) Resamplingrr3r1r4r2r N) r r!r"NEARESTBOXBILINEARHAMMINGBICUBICLANCZOSr#r$r%rErEs,G CHGGGGGr$rE??@g@ceZdZdZdZdZdZdS)Ditherrr r1r2N)r r!r"NONEORDERED RASTERIZEFLOYDSTEINBERGr#r$r%rPrPs" DGINNNr$rPceZdZdZdZdS)Paletterr N)r r!r"WEBADAPTIVEr#r$r%rVrVs CHHHr$rVceZdZdZdZdZdZdS)Quantizerr r1r2N)r r!r" MEDIANCUT MAXCOVERAGE FASTOCTREE LIBIMAGEQUANTr#r$r%rZrZs"IKJMMMr$rZDEFAULT_STRATEGY)Element) PrettyPrinter) ImageFile ImageFilter ImagePaletteImageQtTiffImagePlugin) CapsuleType NumpyArrayStrOrBytesPath list[str]IDzodict[str, tuple[Callable[[IO[bytes], str | bytes], ImageFile.ImageFile], Callable[[bytes], bool | str] | None]]OPENdict[str, str]MIMEz:dict[str, Callable[[Image, IO[bytes], str | bytes], None]]SAVESAVE_ALL EXTENSIONz$dict[str, type[ImageFile.PyDecoder]]DECODERSz$dict[str, type[ImageFile.PyEncoder]]ENCODERSlittle<>imImagereturntuple[tuple[int, ...], str]ctj|j}|j|jf}t |j}|dkr||fz }||jfSNr )r getmodemodeheightwidthlenbandstypestr)rwmshapeextras r%_conv_type_shapersQ"'""A i2E LLE zz % !) r$)1CMYKFHSVII;16I;16BI;16LzI;16NLLALaLABPPARGBRGBARGBaRGBXYCbCr)rrrrrrrrr~strc4tj|jS)a% Gets the "base" mode for given mode. This function returns "L" for images that contain grayscale data, and "RGB" for images that contain color data. :param mode: Input mode. :returns: "L" or "RGB". :exception KeyError: If the input mode was not a standard mode. )r r}basemoder~s r% getmodebasers  T " " ++r$c4tj|jS)a  Gets the storage type mode. Given a mode, this function returns a single-layer mode suitable for storing individual bands. :param mode: Input mode. :returns: "L", "I", or "F". :exception KeyError: If the input mode was not a standard mode. )r r}basetypers r% getmodetypers  T " " ++r$tuple[str, ...]c4tj|jS)a Gets a list of individual band names. Given a mode, this function returns a tuple containing the names of individual bands (use :py:method:`~PIL.Image.getmodetype` to get the mode used to store each individual band. :param mode: Input mode. :returns: A tuple containing band names. The length of the tuple gives the number of bands in an image of the given mode. :exception KeyError: If the input mode was not a standard mode. )r r}rrs r%getmodebandnamesr's  T " " ((r$intcNttj|jS)z Gets the number of individual bands for this mode. :param mode: Input mode. :returns: The number of bands in this mode. :exception KeyError: If the input mode was not a standard mode. )rr r}rrs r% getmodebandsr6s  y &&, - --r$z.bmpBmpImagePluginz.dibz.gifGifImagePluginz.jfifJpegImagePluginz.jpez.jpgz.jpegz.pbmPpmImagePluginz.pgmz.pnmz.ppmz.pfmz.pngPngImagePluginz.apngz.avifAvifImagePluginz.avifsz.blpBlpImagePluginz.bufrBufrStubImagePluginz.curCurImagePluginz.dcxDcxImagePluginz.ddsDdsImagePluginz.psEpsImagePluginz.epsz.fitFitsImagePluginz.fitsz.fliFliImagePluginz.flcz.fpxFpxImagePluginz.ftcFtexImagePluginz.ftuz.gbrGbrImagePluginz.gribGribStubImagePluginz.h5Hdf5StubImagePluginz.hdfz.icnsIcnsImagePluginz.icoIcoImagePluginz.im ImImagePluginz.iimIptcImagePluginz.jp2Jpeg2KImagePluginz.j2kz.jpcz.jpfz.jpxz.j2cz.micMicImagePluginz.mpgMpegImagePluginz.mpegz.mpoMpoImagePluginz.mspMspImagePluginz.palmPalmImagePluginz.pcdPcdImagePluginz.pcxPcxImagePluginz.pdfPdfImagePluginz.pxrPixarImagePluginz.psdPsdImagePluginz.qoiQoiImagePluginz.bwSgiImagePluginz.rgbz.rgbaz.sgiz.rasSunImagePluginz.tgaTgaImagePluginz.icbz.vdaz.vstz.tifrfz.tiffz.webpWebPImagePluginWmfImagePluginXbmImagePluginXpmImagePlugin)z.wmfz.emfz.xbmz.xpm_EXTENSION_PLUGINext str | bytesc|sdSt|tr|}|}|tvrdSt |}|dS td|ttj d|ttgdS#t$r'}td||Yd}~dSd}~wwxYw)z>>>DDDDHLLLL HLLLLLLr$r exprdddZ?e ddZ@ddZAddZBddZC dddZD dddZE dddZF dddZG dddZHddZI d d!dZJ dd"dZKd#dZL dd$dZMd%dZN d&d'dZO dd(dZPeQjRddddfd)dĄZS dd*dȄZTd+dɄZUd,d˄ZVdd-d̈́ZWd.dτZXd/d҄ZYddӄZZeQj[dfd0dքZ\deQjRddfd1dۄZ]eQjRdfd2dބZ^d3dZ_d4dZ`d5dZad6dZbdS(7rxaD This class represents an image object. To create :py:class:`~PIL.Image.Image` objects, use the appropriate factory functions. There's hardly ever any reason to call the Image constructor directly. * :py:func:`~PIL.Image.open` * :py:func:`~PIL.Image.new` * :py:func:`~PIL.Image.frombytes` N str | Noneformatformat_descriptionTryrchd|_d|_d|_d|_i|_d|_d|_dS)Nrrrr)_im_mode_sizepaletteinforeadonly_exifrs r%rzImage.__init__ys7<@  9= 68  "& r$core.ImagingCorecnt|jtr |jj|jJ|jSr)rr:rexrs r%rwzImage.ims5 dh . . (+ x###xr$rwc||_dSr)r:rrws r%rwzImage.ims r$rc|jdSNrsizers r%rz Image.widthy|r$c|jdSr|rHrs r%rz Image.heightrJr$tuple[int, int]c|jSr)r<rs r%rIz Image.size zr$rc|jSr)r;rs r%r~z Image.moderNr$c6|jr |jjp|jSr)r:r? _readonlyrs r%r?zImage.readonlys.TX.A4>Ar$r?c||_dSr)rQ)rr?s r%r?zImage.readonlys !r$c.t}||_|j|_|j|_|jdvr@|jr|j|_nddlm }|j |_|j |_ |S)Nrrr rd) rxrwr~r;rIr<r=copyrrdr>)rrwnewrds r%_newz Image._newsggG G 7k ! !| :"l//11 ******7l799 9>>## r$c|Srr#rs r% __enter__zImage.__enter__s r$robjectcdSrr#)rrs r%__exit__zImage.__exit__s r$ct|ddrEtjdkr.ttdr|jd|_t td|_dS)av This operation will destroy the image core and release its memory. The image data will be unusable afterward. This function is required to close images that have multiple frames or have not had their file read and closed by the :py:meth:`~PIL.Image.Image.load` method. See :ref:`file-handling` for more information. mapNwin32pypy_version_infozOperation on closed image) rsysplatformhasattrr_closer ValueErrorr:rs r%rez Image.closesl 4 % % .|w&&738K+L+L&   )-DH !,G!H!HIIr$cx||j|_d|_dSrG)loadrwrVr?rs r%_copyz Image._copys+ ',,.. r$ch|jr|dS|dSr)r?rirhrs r%_ensure_mutablezImage._ensure_mutables. =  JJLLLLL IIKKKKKr$fileoptionsrc |rd|nd}|r|}||s||z }n+tj|\}}tj||j||pdfi||S)NrrPPM)endswithtempfilemkstemposresave)rrlr6rmsuffixfilenamefs r%_dumpz Image._dumps"(/VR  H$$V,, #F""*622KAx HQKKK (FOe77w777r$rr)cX|j|jurdSt|tsJ|j|jkos|j|jkoc|j|jkoS||ko)||kSNF) __class__rrxr~rIr> getpalettetobytesrs r%__eq__z Image.__eq__s > 0 05%''''' I # 2 UZ' 2 UZ' 2!!U%5%5%7%77 2 %--//1  r$cd|jjd|jjd|jd|jdd|jddt |d d S) Nrur image mode= size=rxr z at 0xXrv)r{r!r r~rIidrs r%__repr__zImage.__repr__s~ ") " "DN,C " ") " "+/9Q< " ":>)A, " "tHH ! " " " r$pracyclec |d|jjd|jjd|jd|jdd|jdd d S) z"IPython plain text display supportrurrrrrr rvN)textr{r!r r~rI)rrrs r% _repr_pretty_zImage._repr_pretty_s  J) J JDN,C J J) J J+/9Q< J J:>)A, J J J     r$ image_formatkwargs bytes | Nonec tj} |j||fi|n#t$rYdSwxYw|S)zHelper function for iPython display hook. :param image_format: Image format. :returns: image as bytes, saved into the given format. N)ioBytesIOrt Exceptiongetvalue)rrrbs r% _repr_imagezImage._repr_image sc JLL  DIa 0 0 0 0 0 0   44 zz||s % 33c0|ddS)zjiPython display hook support for PNG format. :returns: PNG version of the image as bytes PNGr )compress_levelrrs r% _repr_png_zImage._repr_png_s a888r$c,|dS)zliPython display hook support for JPEG format. :returns: JPEG version of the image as bytes JPEGrrs r% _repr_jpeg_zImage._repr_jpeg_s '''r$.dict[str, str | bytes | int | tuple[int, ...]]cddi}|jdkr|dd|d<n||d<t|\|d<|d<|S) Nversionr2rrawrdatarr)r~r}r)rrWs r%__array_interface__zImage.__array_interface__$sg@I!n 9  ,,uc22CKK,,..CK'7'='=$G c)n r$c\||jSr)rhrw__arrow_c_schema__rs r%rzImage.__arrow_c_schema__1s# w))+++r$requested_schema object | Nonetuple[object, object]c||j|jfSr)rhrwr__arrow_c_array__rrs r%rzImage.__arrow_c_array__5s8 **,,dg.G.G.I.IJJr$ list[Any]cz|}|j|j|j||gSr)r}r>r~rIr|)rim_datas r% __getstate__zImage.__getstate__;s0,,.. 49di1B1BGLLr$statect||dd\}}}}}||_||_||_t j|||_|dvr|r||| |dS)Nr4rrrr) rxrr>r;r<rrWrw putpalette frombytes)rrr>r~rIr=rs r% __setstate__zImage.__setstate__?s t*/)'dD'4   (4&& ) ) )g ) OOG $ $ $ tr$rrrc~|}t|dkr#t|dtr|d}|dkr |dkr|j}||jdks |jdkrdSt|j||}||j d|j zddl m }t|j|j ddz}g} ||\}} } || | rn2| dkrd | d } t#| d|S) a Return image as a bytes object. .. warning:: This method returns raw image data derived from Pillow's internal storage. For compressed image data (e.g. PNG, JPEG) use :meth:`~.save`, with a BytesIO parameter for in-memory data. :param encoder_name: What encoder to use. The default is to use the standard "raw" encoder. To see how this packs pixel data into the returned bytes, see :file:`libImaging/Pack.c`. A list of C encoders can be seen under codecs section of the function array in :file:`_imaging.c`. Python encoders are registered within the relevant plugins. :param args: Extra arguments to the encoder. :returns: A :py:class:`bytes` object. r rrr#r$r9rbr3Tzencoder error z in tobytes)rrrr~rhrrrsetimagerwrIrrbmaxMAXBLOCKencodeappend RuntimeErrorjoin) rrr encoder_argsrrbbufsizeoutputbytes_consumederrcoderrs r%r}z Image.tobytesJs]0! |   ! !ja%&H&H !'?L 5 \R%7%79L :??dkQ..3  < > > 47FTY.///i($)A,*:;; ,-HHW,=,= )NGT MM$       Q;;77777Cs## #xxr$imagenamec||jdkrd}t||d}dd|d|jddd d|d |jd dd d |d d |dgS)a- Returns the image converted to an X11 bitmap. .. note:: This method only works for mode "1" images. :param name: The name prefix to use for the bitmap variables. :returns: A string containing an X11 bitmap. :raises ValueError: If the mode is not "1" rz not a bitmapxbmr$z#define z_width r asciiz_height r z static char z _bits[] = { s};)rhr~rfr}rrIr)rrrrs r%tobitmapzImage.tobitmaps 9   CS// !||E""xx8488 ! 888??HH94991999@@II3t333::7CC     r$r DecoderInputrcZ|jdks |jdkrdS|}t|dkr#t|dtr|d}|r=|ddvr3|ddkrdnd}t||zrd}t ||d kr |d kr|j}t|j||}||j d |j z| |}|ddkrd}t ||ddkrd }t |dS) z Loads this image with pixel data from a bytes object. This method is similar to the :py:func:`~PIL.Image.frombytes` function, but loads data into this image instead of creating a new image object. rNr >P;4LP;2Lrr3znot enough image datarr#r9zcannot decode image data) rrrrrrfr~rrrwrIr) rrrr decoder_argsmultiplerdss r%rzImage.frombytessH :??dkQ.. F |   ! !ja%&H&H !'?L  &LO/???(Ov55qq1H4yy8# &- oo% 5 \R%7%79L  < > > 47FTY./// HHTNN Q4199)CS// ! Q4199,CS// ! 9r$core.PixelAccess | Nonec|j>|jr6|jjr)|j\}}|j|jj||d|j_d|j_d|jvr}|dvryt|jdtr'|j |jddn%|j |jdd|j_nI|jj|kr9|j |jj|jj|j_|j|j|jSdS)at Allocates storage for the image and loads the pixel data. In normal cases, you don't need to call this method, since the Image class automatically loads an opened image when it is accessed for the first time. If the file associated with the image was opened by Pillow, then this method will close it. The exception to this is if the image has multiple frames, in which case the file will be left open for seek operations. See :ref:`file-handling` for more information. :returns: An image access object. :rtype: :py:class:`.PixelAccess` Nr transparencyrrr)r:r=dirtyr3rwrr~rawmoder>rrputpalettealphaputpalettealphasr| pixel_accessr?)rr~arrs r%rhz Image.loadsH 8 DL T\5G  ,,..ID# G  t|0$ < < j kr|j |}||} d!d"l!m"}|j"d| j#d| _|r| jd=|q | jtItt:d#f|| | jd<n,#tJ$r| jd=t'jd$YnwxYw| Sd%|j|fvr|}|d%kr&|jd&vr|d}|j}n|}|d&vrd!d'l!m&}|'d(}|'d%}|jd%kr||gn||g}|(|d|d!|j|}|)|S| tTj+} |j||}n#t $ry tY|j}||jkr|j|}|||}n$#tZ$r}d}t ||d}~wwxYwYnwxYw||} |d)vr?|t>j kr/d!d"l!m"}|j"d|#d| _|r| jd=|| jdkr| jr | jtItt:d#f|| | jd<nP#t $r9}| jd=t1|dkrt'jd$Yd}~nd}~wwxYw|| jd<| S)+a Returns a converted copy of this image. For the "P" mode, this method translates pixels through the palette. If mode is omitted, a mode is chosen so that all information in the image and the palette can be represented without a palette. This supports all possible conversions between "L", "RGB" and "CMYK". The ``matrix`` argument only supports "L" and "RGB". When translating a color image to grayscale (mode "L"), the library uses the ITU-R 601-2 luma transform:: L = R * 299/1000 + G * 587/1000 + B * 114/1000 The default method of converting a grayscale ("L") or "RGB" image into a bilevel (mode "1") image uses Floyd-Steinberg dither to approximate the original image luminosity levels. If dither is ``None``, all values larger than 127 are set to 255 (white), all other values to 0 (black). To use other thresholds, use the :py:meth:`~PIL.Image.Image.point` method. When converting from "RGBA" to "P" without a ``matrix`` argument, this passes the operation to :py:meth:`~PIL.Image.Image.quantize`, and ``dither`` and ``palette`` are ignored. When converting from "PA", if an "RGBA" palette is present, the alpha channel from the image will be used instead of the values from the palette. :param mode: The requested mode. See: :ref:`concept-modes`. :param matrix: An optional conversion matrix. If given, this should be 4- or 12-tuple containing floating point values. :param dither: Dithering method, used when converting from mode "RGB" to "P" or from "RGB" or "L" to "1". Available methods are :data:`Dither.NONE` or :data:`Dither.FLOYDSTEINBERG` (default). Note that this is not used when ``matrix`` is supplied. :param palette: Palette to use when converting from mode "RGB" to "P". Available palettes are :data:`Palette.WEB` or :data:`Palette.ADAPTIVE`. :param colors: Number of colors to use for the :data:`Palette.ADAPTIVE` palette. Defaults to 256. :rtype: :py:class:`~PIL.Image.Image` :returns: An :py:class:`~PIL.Image.Image` object. rrrr)rrzillegal conversionr2rtuple[float, ...]vtuple[int, int, int]ryrc |d|dz|d|dzz|d|dzz|ddzz}tdtdt|S)Nrr r1r2rL)rminr)rrvalues r%convert_transparencyz+Image.convert..convert_transparencyEsdaD1Q4K!A$1+5!qt CadSjPEq#c3u::"6"6777r$rc3RK|]!}|dz|dzdzV"dS)r3Nr#).0irrrs r% z Image.convert..NsZ))-,VAEAEAI4E-F UU))))))r$rNF)rrrrrr)rrrr)rrrzVPalette images with Transparency expressed in bytes should be converted to RGBA imagesTr r z2Couldn't allocate a palette color for transparencyz$cannot allocate more than 256 colorsr9rrrrz.Transparency for P mode should be bytes or intr rU.z0Couldn't allocate palette entry for transparencyr)rrr)ImageCmssRGBrT)rrrrryr).rhr>r~r=rVrfrwconvert_matrixrXrrrrangequantizesplitmergeconvert_transparentrrwarningswarnrWrgetcolorrputpixelconvertgetpixelrrrrVrXrrdr|rrr createProfilebuildTransformapplyrPrTrr) rr~rrr=rhas_transparencyrrwnew_imrgrr-rgbrtrns delete_trnsttrns_imerrrrd other_modersrgblabprofiles transformmodebaserrs ` @@r%rz Image.convertsh )TY6  S((| |(u}}!1}  ))&)99;;   <''* oo%''f55BYYr]]F ;DGMQ$6$6%{>: 8888 3;;#7#7 #M#MLLYY!^^#())))))!&s<'8'8!9!9)))$$L/; N+M 9  s{{}}V,,,!ZZ\\ 1aEAq!9--LL((TAq6*** > * 4449O9O U""t/K'K'KG//di6OPPK/ ///D#>#>A$+O$<$*F -v..BB - - - -&ty11ty((W__X..ZZf-- - - -* oo1, - -2 ;  7g.>#>#> & & & & & &6\6ubmmE>R>RSSFN  , N+  {c!!fn! 28.2I2IU38_d33V33FK//" N31vv!GGG! N /3 N+ s{!K== L7&L22L70AS44&TT1X ZAY)(Z) Z 3ZZ  ZZ A] ^/^  ^rmethodr+kmeans Image | NonerPc||#tj}|jdkr tj}|jdkr+|tjtjfvrd}t ||r||jdkrd}t ||jdvrd}t ||jd||j}| |}|j J|j |_ |S|dkrd }t || |j |||}d d l m} |j} |j| | d|t#| z} | j| | |_ |S) a3 Convert the image to 'P' mode with the specified number of colors. :param colors: The desired number of colors, <= 256 :param method: :data:`Quantize.MEDIANCUT` (median cut), :data:`Quantize.MAXCOVERAGE` (maximum coverage), :data:`Quantize.FASTOCTREE` (fast octree), :data:`Quantize.LIBIMAGEQUANT` (libimagequant; check support using :py:func:`PIL.features.check_feature` with ``feature="libimagequant"``). By default, :data:`Quantize.MEDIANCUT` will be used. The exception to this is RGBA images. :data:`Quantize.MEDIANCUT` and :data:`Quantize.MAXCOVERAGE` do not support RGBA images, so :data:`Quantize.FASTOCTREE` is used by default instead. :param kmeans: Integer greater than or equal to zero. :param palette: Quantize to the palette of given :py:class:`PIL.Image.Image`. :param dither: Dithering method, used when converting from mode "RGB" to "P" or from "RGB" or "L" to "1". Available methods are :data:`Dither.NONE` or :data:`Dither.FLOYDSTEINBERG` (default). :returns: A new image NrzoFast Octree (method == 2) and libimagequant (method == 3) are the only valid methods for quantizing RGBA imagesrzbad mode for palette image>rrz7only RGB or L mode images can be quantized to a paletterzkmeans must not be negativer rU)rhrZr[r~r]r^rfrwrrXr=rVrrrdgetpalettemoder|r) rrrrr=rrrwrrdr~ palette_datas r%rzImage.quantizesF >'FyF""!, 9  6    "2 $ $ H S// !   LLNNN|s""2 oo%y ,,O oo%fgj99BYYr]]F?...$_1133FNM A::/CS// ! YYtw''?? @ @""""""u##%%u''d334Hfs4yy6H4HI .\.t\BB  r$c|||jS)z Copies this image. Use this method if you wish to paste things into an image, but still retain the original. :rtype: :py:class:`~PIL.Image.Image` :returns: An :py:class:`~PIL.Image.Image` object. )rhrXrwrVrs r%rVz Image.copyLs- yy(((r$box(tuple[float, float, float, float] | Nonec>||S|d|dkrd}t||d|dkrd}t|||||j|S)a Returns a rectangular region from this image. The box is a 4-tuple defining the left, upper, right, and lower pixel coordinate. See :ref:`coordinate-system`. Note: Prior to Pillow 3.4.0, this was a lazy operation. :param box: The crop rectangle, as a (left, upper, right, lower)-tuple. :rtype: :py:class:`~PIL.Image.Image` :returns: An :py:class:`~PIL.Image.Image` object. Nr1rz&Coordinate 'right' is less than 'left'r2r z'Coordinate 'lower' is less than 'upper')rVrfrhrX_croprw)rrrs r%cropz Image.cropYs ;99;;  q6CF??:CS// ! Vc!f__;CS// ! yyDGS11222r$!tuple[float, float, float, float]ctttt|\}}}}t||z t||z f}t ||||||fS)a] Returns a rectangular region from the core image object im. This is equivalent to calling im.crop((x0, y0, x1, y1)), but includes additional sanity checks. :param im: a core image object :param box: The crop rectangle, as a (left, upper, right, lower)-tuple. :returns: A core image object. )r_rroundabs_decompression_bomb_checkr!)rrwrx0y0x1y1absolute_valuess r%r z Image._cropssjS#eS//22BBrBw<<R"W6!/222wwBB'(((r$rItuple[int, int] | None0tuple[str, tuple[int, int, float, float]] | NonecdS)aY Configures the image file loader so it returns a version of the image that as closely as possible matches the given mode and size. For example, you can use this method to convert a color JPEG to grayscale while loading it. If any changes are made, returns a tuple with the chosen ``mode`` and ``box`` with coordinates of the original image within the altered one. Note that this method modifies the :py:class:`~PIL.Image.Image` object in place. If the image has already been loaded, this method has no effect. Note: This method is not implemented for most images. It is currently implemented only for JPEG and MPO images. :param mode: The requested mode. :param size: The requested size in pixels, as a 2-tuple: (width, height). Nr#)rr~rIs r%draftz Image.drafts . r$filter-ImageFilter.Filter | type[ImageFilter.Filter]cddlm}tr t dsd}t |t |j}jj dks|r-  jSfdtjj D}tj|S)z Filters this image using the given filter. For a list of available filters, see the :py:mod:`~PIL.ImageFilter` module. :param filter: Filter kernel. :returns: An :py:class:`~PIL.Image.Image` object.r )rcr0z>filter argument should be ImageFilter.Filter instance or classc g|]B}j|CSr#)rXr0rwgetband)rcr0rs r% z Image.filter..sL   =>DIIfmmDGOOA$6$677 8 8   r$)rrcrhcallablerd TypeErrorrMultibandFilterrwrrXr0rrr~)rr0rcr multibandimss`` r%r0z Image.filters "!!!!! F   VXXFvx(( !RCC.. v{'BCC 7=A   99V]]473344 4     BG BVBV   TY$$$r$rc>tj|jjS)z Returns a tuple containing the name of each band in this image. For example, ``getbands`` on an RGB image returns ("R", "G", "B"). :returns: A tuple containing band names. :rtype: tuple )r r}r~rrs r%getbandszImage.getbandss ++11r$) alpha_onlyr> tuple[int, int, int, int] | Nonec^||j|S)aG Calculates the bounding box of the non-zero regions in the image. :param alpha_only: Optional flag, defaulting to ``True``. If ``True`` and the image has an alpha channel, trim transparent pixels. Otherwise, trim pixels when all channels are zero. Keyword-only argument. :returns: The bounding box is returned as a 4-tuple defining the left, upper, right, and lower pixel coordinate. See :ref:`coordinate-system`. If the image is completely empty, this method returns None. )rhrwgetbbox)rr>s r%rAz Image.getbboxs% wz***r$ maxcolorsBlist[tuple[int, tuple[int, ...]]] | list[tuple[int, float]] | Nonec||jdvrK|jfdt dD}t ||krdS|S|j|S)a Returns a list of colors used in this image. The colors will be in the image's mode. For example, an RGB image will return a tuple of (red, green, blue) color values, and a P image will return the index of the color in the palette. :param maxcolors: Maximum number of colors. If this number is exceeded, this method returns None. The default limit is 256 colors. :returns: An unsorted list of (count, pixel) values. )rrrc4g|]}| ||fSr#r#)rrhs r%r6z#Image.getcolors..s*+R+R+R!QqT+RQqT1I+R+R+Rr$rN)rhr~rw histogramrr getcolors)rrBoutrFs @r%rHzImage.getcolorss 9 ' '!!##A+R+R+R+RuSzz+R+R+RC3xx)##tJw  +++r$bandctddd|||j|S|jS)a Returns the contents of this image as a sequence object containing pixel values. The sequence object is flattened, so that values for line one follow directly after the values of line zero, and so on. Note that the sequence object returned by this method is an internal PIL data type, which only supports certain sequence operations. To convert it to an ordinary sequence (e.g. for printing), use ``list(im.getdata())``. :param band: What band to return. The default is to return all bands. To return a single band, pass in the index value (e.g. 0 to get the "R" band from an "RGB" image). :returns: A sequence-like object. zImage.Image.getdataget_flattened_data)rrhrwr4rrJs r%r3z Image.getdatasF" '-ABBB  7??4(( (wr$/tuple[tuple[int, ...], ...] | tuple[float, ...]c||'t|j|St|jS)a Returns the contents of this image as a tuple containing pixel values. The sequence object is flattened, so that values for line one follow directly after the values of line zero, and so on. :param band: What band to return. The default is to return all bands. To return a single band, pass in the index value (e.g. 0 to get the "R" band from an "RGB" image). :returns: A tuple containing pixel values. )rhrrwr4rNs r%rMzImage.get_flattened_data sA  ..// /TW~~r$1tuple[float, float] | tuple[tuple[int, int], ...]cjjdkr2tfdt jjDSjS)a" Gets the minimum and maximum pixel values for each band in the image. :returns: For a single-band image, a 2-tuple containing the minimum and maximum pixel value. For a multi-band image, a tuple containing one 2-tuple for each band. r c3pK|]0}j|V1dSr)rwr4 getextrema)rrrs r%rz#Image.getextrema..)s=WWQ++6688WWWWWWr$)rhrwrrrrTrs`r%rTzImage.getextremasd 7=1  WWWW% BVBVWWWWW Ww!!###r$dict[str, Any]cd ddfd ttjd iSd |jvriStj|jd d }|j|iS)z Returns a dictionary containing the XMP tags. Requires defusedxml to be installed. :returns: XMP tags in a dictionary. tagrryc.tjdd|S)Nz^{[^}]+}r)resub)rWs r%get_namezImage.getxmp..get_name4s6*b#.. .r$elementr`str | dict[str, Any] | Nonecfd|jD}t|}|rm|D]i}|j}|}||vrCt ||ts ||g||<|||d|||<jn|r|jr |j|d<n|jS|S)Nc.i|]\}}||Sr#r#)rkrr[s r% z3Image.getxmp..get_value..8s'$W$W$W1XXa[[!$W$W$Wr$r)attribitemslistrWrrr)r\rchildrenchildr child_valuer[ get_values r%rhzImage.getxmp..get_value7s$W$W$W$W@T@T@V@V$W$W$WEG}}H $%22E#8EI..D"+)E"2"2Ku}})%+t<<8+0;-E$Kd **;7777&1d 2 $<1$+LE&M|#Lr$Nz5XMP data cannot be read without defusedxml dependencyxmps )rWrryr)r\r`ryr])rrrr> fromstringrstriprW)rrootr[rhs @@r%getxmpz Image.getxmp,s / / / /       (   MQ R R RI  ! !I%di&6&=&=h&G&GHH""IIdOO44r$Exifc|jt|_n|jjr|jSd|j_|jd}|d|jvrTt d|jdddd}nt|dr|d d l m }t||j sJ|jj|j_|jj|j_|jJ|j|j|jj||j|t.jj|jvr|jd }d }|s|jd x}rd}|rCt5j||}|r,t9|d|jt.jj<|jS)zj Gets EXIF data from the image. :returns: an :py:class:`~PIL.Image.Exif` object. NTexifzRaw profile type exifrrr2tag_v2r rfzXML:com.adobe.xmpztiff:Orientation(="|>)([0-9])ristiff:Orientation(="|>)([0-9])r1)r@rn_loadedr>rrfromhexrrrdrrfr TiffImageFilerq_bigtiffbigtiff_endianendianfp load_from_fp_offsetrhr Base OrientationrYsearchr)r exif_inforfxmp_tagspatternmatchs r%getexifz Image.getexifSs : DJJ Z  : ! IMM&))  &$)33!MMGGDI&=>DDTJJ122NOO x(( F------!$(EFFFFF%)[%9 "$(K$7 !w*** ''1DEEE  JOOI & & & = $DJ 6 6y}}%899H#CG >c|jdvs d|jvrdS|jdkr(|jJ|jjdSdS)aN Determine if an image has transparency data, whether in the form of an alpha channel, a palette with an alpha channel, or a "transparency" key in the info dictionary. Note the image might still appear solid, if all of the values shown within are opaque. :returns: A boolean. )rrrrrrTrNAF)r~r>r=rprs r%has_transparency_datazImage.has_transparency_datas] I; ; ;**4 9  <+++<$--c22 2ur$cz|jdks d|jvrdSddlm}|d}|J|jd}t |t r!t|D]\}}|||dzdz<n d ||dzdz<|jdt ||_d|j_ |jd=dS) z If a P mode image has a "transparency" key in the info dictionary, remove the key and instead apply the transparency to the palette. Otherwise, the image is unchanged. rrNr rUrr3r2r) r~r>rrdr|rr enumerater=r)rrdr=rralphas r%apply_transparencyzImage.apply_transparencys 9  ~TY>> F""""""//&))"""y0 lE * * .%l33 + +5%*A "" +-.GL1$q( )0|0wHH   In % % %r$xytuple[int, int] | list[int]float | tuple[int, ...] | Nonecx||jt|S)a  Returns the pixel value at a given position. :param xy: The coordinate, given as (x, y). See :ref:`coordinate-system`. :returns: The pixel value. If the image is a multi-layer image, this method returns a tuple. )rhrwrr)rrs r%rzImage.getpixels- wb ***r$tuple[list[int], list[int]]c||j\}}t|t|fS)z Get projection to x and y axes :returns: Two sequences, indicating where there are non-zero pixels along the X-axis and the Y-axis, respectively. )rhrw getprojectionrd)rrys r%rzImage.getprojections? w$$&&1AwwQr$maskextrematuple[float, float] | None list[int]c:||r4||jd|jS|jdvr0|j||n|S|jS)a Returns a histogram for the image. The histogram is returned as a list of pixel counts, one for each pixel value in the source image. Counts are grouped into 256 bins for each band, even if the image has more than 8 bits per band. If the image has more than one band, the histograms for all bands are concatenated (for example, the histogram for an "RGB" image contains 768 values). A bilevel image (mode "1") is treated as a grayscale ("L") image by this method. If a mask is provided, the method returns a histogram for those parts of the image where the mask image is non-zero. The mask image must have the same size as the image, and be either a bi-level image (mode "1") or a grayscale image ("L"). :param mask: An optional mask. :param extrema: An optional tuple of manually-specified extrema. :returns: A list containing pixel counts. r9rr)rhrwrGr~rTrrrs r%rGzImage.histograms.  6 IIKKK7$$VTW55 5 9 " "7$$".DOO4E4E w  """r$r c:||r4||jd|jS|jdvr0|j||n|S|jS)ah Calculates and returns the entropy for the image. A bilevel image (mode "1") is treated as a grayscale ("L") image by this method. If a mask is provided, the method employs the histogram for those parts of the image where the mask image is non-zero. The mask image must have the same size as the image, and be either a bi-level image (mode "1") or a grayscale image ("L"). :param mask: An optional mask. :param extrema: An optional tuple of manually-specified extrema. :returns: A float value representing the image entropy r9r)rhrwentropyr~rTrs r%rz Image.entropys$  4 IIKKK7??64733 3 9 " "7??".DOO4E4E w   r$'Image | str | float | tuple[float, ...]:Image | tuple[int, int, int, int] | tuple[int, int] | Nonect|tr|d}t||}d}|d}t|dkrpt|tr|j}n.t|tr|j}nd}t|||d|dz|d|dzfz }t|t r"ddlm}|||j }nqt|trZ| |j |j kr.|j d ks |j d vr| |j }|j }n|}| |r7| |j |||j dS|j ||dS) a Pastes another image into this image. The box argument is either a 2-tuple giving the upper left corner, a 4-tuple defining the left, upper, right, and lower pixel coordinate, or None (same as (0, 0)). See :ref:`coordinate-system`. If a 4-tuple is given, the size of the pasted image must match the size of the region. If the modes don't match, the pasted image is converted to the mode of this image (see the :py:meth:`~PIL.Image.Image.convert` method for details). Instead of an image, the source can be a integer or tuple containing pixel values. The method then fills the region with the given color. When creating RGB images, you can also use color strings as supported by the ImageColor module. See :ref:`colors` for more information. If a mask is given, this method updates only the regions indicated by the mask. You can use either "1", "L", "LA", "RGBA" or "RGBa" images (if present, the alpha band is used as mask). Where the mask is 255, the given image is copied as is. Where the mask is 0, the current value is preserved. Intermediate values will mix the two images together, including their alpha channels if they have them. See :py:meth:`~PIL.Image.Image.alpha_composite` if you want to combine images with respect to their alpha channels. :param im: Source image or pixel value (integer, float or tuple). :param box: An optional 4-tuple giving the region to paste into. If a 2-tuple is used instead, it's treated as the upper left corner. If omitted or None, the source is pasted into the upper left corner. If an image is given as the second argument and there is no third, the box defaults to (0, 0), and the second argument is interpreted as a mask image. :param mask: An optional mask image. Nz=If using second argument as mask, third argument must be Noner9r1z,cannot determine region size; use 4-item boxrr  ImageColorr)rrr)rrxrfrrIrrrrr~rhrrwrkpaste)rrwrrrrIrsources r%rz Image.paste0s\ c5 ! ! U oo%DC ;C s88q=="e$$ &wD%(( &yE oo% CFT!W$c!ftAw&67 7C b#    $ $ $ $ $ $((TY77FF E " "  GGIIIyBG##9%%8N)N)NDI..BUFFF   ' IIKKK GMM&#tw / / / / / GMM&# & & & & &r$r9dest Sequence[int]rcLt|ttfsd}t|t|ttfsd}t|t |dkrt|}nCS// !4yyA~~>CS// ! v;;??/CS// ! v/ / /GGgg.//GDkkT!Ww}4d1g6NOO &49$ $ $JJ3J W55 63r$lutSequence[float] | NumpyArray | Callable[[int], float] | Callable[[ImagePointTransform], ImagePointTransform | float] | ImagePointHandlerc>|ttr|St rr|jdvr@t \}}||j ||SfdtdD|jj z}n}|jdkrd}t||dkr d|D}||j||S)a Maps this image through a lookup table or function. :param lut: A lookup table, containing 256 (or 65536 if self.mode=="I" and mode == "L") values per band in the image. A function can be used instead, it should take a single argument. The function is called once for each possible pixel value, and the resulting table is applied to all bands of the image. It may also be an :py:class:`~PIL.Image.ImagePointHandler` object:: class Example(Image.ImagePointHandler): def point(self, im: Image) -> Image: # Return result :param mode: Output mode (default is same as input). This can only be used if the source image has mode "L" or "P", and the output has mode "1" or the source image mode is "I" and the output mode is "L". :returns: An :py:class:`~PIL.Image.Image` object. )rrrc&g|] }|Sr#r#)rrrs r%r6zImage.point..s!222!ss1vv222r$rrz+point operation not supported for this modec,g|]}t|Sr#)r$rrs r%r6zImage.point..s111AuQxx111r$) rhrImagePointHandlerpointr7r~r.rXrwpoint_transformrrrf)rrr~r r flatLutrs ` r%rz Image.pointsB c, - - #99T?? " C== y...!0 4 4 vyy!8!8!G!GHHH2222uSzz222TW]BGGG 9  ?CS// ! 3;;11111Gyyw55666r$r Image | intc||jdvr t|jdz} |j|nZ#t t f$rF}|j|}|jdvrd}t ||||_Yd}~nd}~wwxYw|jj|_n$#t$r}d}t ||d}~wwxYw|jdvrd}nd}t|trO|jd vrd}t || |jd kr|d }nK |j ||dS#t t f$rtd |j|}YnwxYw|j|j|dS) aZ Adds or replaces the alpha layer in this image. If the image does not have an alpha layer, it's converted to "LA" or "RGBA". The new layer must be either "L" or "1". :param alpha: The new alpha layer. This can either be an "L" or "1" image having the same size as this image, or an integer. rrz alpha channel could not be addedNillegal image moderr r2)rrrr)rkr~rrwsetmoderrfrr;rrrxrhfillbandrWrIputband)rrr~rrwrrJs r%putalphazImage.putalphas  90 0 0 -"49--3!GOOD))))& 3!!!..Bw&:::@(oo14 DGGGGGG !"W\  - - -* oo1, - 9 $ $DDD eU # # z++* oo% JJLLLzS   c**   u---  #J/ 3 3 3CE22 3 $'''''sRB>AB>B)#$B))B>> CCCE22'FFrMISequence[float] | Sequence[Sequence[int]] | core.ImagingCore | NumpyArrayr r cf||j|||dS)a Copies pixel data from a flattened sequence object into the image. The values should start at the upper left corner (0, 0), continue to the end of the line, followed directly by the first value of the second line, and so on. Data will be read until either the image or the sequence ends. The scale and offset values are used to adjust the sequence values: **pixel = value*scale + offset**. :param data: A flattened sequence object. See :ref:`colors` for more information about values. :param scale: An optional scale value. The default is 1.0. :param offset: An optional offset value. The default is 0.0. N)rkrwputdata)rrr r s r%rz Image.putdata7s4(  eV,,,,,r$1ImagePalette.ImagePalette | bytes | Sequence[int]c4ddlm}|jdvrd}t|t ||jrA|j|j|j|j}nS|j|j}d|_n5t |tst|}|j||}d|jvrdnd |_ ||_| d r d |j_nd|vr d |j_n d |j_| dS) a~ Attaches a palette to this image. The image must be a "P", "PA", "L" or "LA" image. The palette sequence must contain at most 256 colors, made up of one integer value for each channel in the raw mode. For example, if the raw mode is "RGB", then it can contain at most 768 values, made up of red, green and blue values for the corresponding pixel index in the 256 colors. If the raw mode is "RGBA", then it can contain at most 1024 values, containing red, green, blue and alpha values. Alternatively, an 8-bit string may be used instead of an integer sequence. :param data: A palette sequence (either a list or a string). :param rawmode: The raw mode of the palette. Either "RGB", "RGBA", "CMYK", or a mode that can be transformed to one of those modes (e.g. "R", "RGBA;L"). r rUrrNr=rrrrrr) rrdr~rfrrrr=rrr; startswithrh)rrrrdrr=s r%rzImage.putpaletteOs/. #""""" 92 2 2&CS// ! dL5 6 6 6|'*,*4<FF3,3DLIII ! dE** #T{{&l&w55G DI--TT3    f % % & &DL   G^^ &DL   %DL  r$r#float | tuple[int, ...] | list[int]c||jdvrt|ttfrt |dvrt|jdkr't |dkr|dnd}|dd}|jJ|jt ||}|jdkr||fn|}|j ||S)a Modifies the pixel at the given position. The color is given as a single numerical value for single-band images, and a tuple for multi-band images. In addition to this, RGB and RGBA tuples are accepted for P and PA images. See :ref:`colors` for more information. Note that this method is relatively slow. For more extensive changes, use :py:meth:`~PIL.Image.Image.paste` or the :py:mod:`~PIL.ImageDraw` module instead. See: * :py:meth:`~PIL.Image.Image.paste` * :py:meth:`~PIL.Image.Image.putdata` * :py:mod:`~PIL.ImageDraw` :param xy: The pixel coordinate, given as (x, y). See :ref:`coordinate-system`. :param value: The pixel value. rT)r2r3rr3r2rN) rkr~rrdrrr=rrwr)rrrr palette_indexs r%rzImage.putpixels4  I $ $54-00 %E f$$yD  $'JJ!OOabqb <+++ L11%,,EEM.2i4.?.?]E**]EwE***r$dest_mapsource_palettebytes | bytearray | Nonecddlm}|jdvrd}t|d}d}||jdkrQ||j}|d krd }|j||}n>td td D}nt|d krd }d }d }dgdz}t|D] \} } ||| |z| |z|zz }| || <!t|} | } d| _ |j|| |z| _| j||dz| j| d} | |||j||| _d|jvrK ||jd| jd<n!#t$rd| jvr| jd=YnwxYw| S)ae Rewrites the image to reorder the palette. :param dest_map: A list of indexes into the original palette. e.g. ``[1,0]`` would swap a two item palette, and ``list(range(256))`` is the identity transform. :param source_palette: Bytes or None. :returns: An :py:class:`~PIL.Image.Image` object. r rU)rrrr2rNrrr3c3 K|] }|dzV dS)r2Nr#rs r%rz&Image.remap_palette..s&*F*Fa16*F*F*F*F*F*Fr$ir$rrrz;Lrr)rrdr~rfrhrwrr| bytearrayrrrrVr;r=rr}rr>index) rrrrdrr palette_mode palette_bytes new_positionsr oldPositionmapping_palettem_ims r% remap_palettezImage.remap_palettesc #""""" 9J & &&CS// !  !yC #w5577 6))E!%!3!3L,!O!O!**F*F5::*F*F*F!F!F  3 & &E!L c (11 + +NA{ ^e#kE&9E&AA M*+M+ & &($M22yy{{ 0|0 /E"9     <)
R>R>T>TUUU||C    |4440|0}UUU TY & & 2,4NN49^;T,U,U .)) 2 2 2!TY.. .1 2 s?(G((HHresamplerEtuple[int, int, int, int]c  t|dz }|d|dz |dz }|d|dz |dz }||z}||z}tdt|d|z tdt|d|z t|jdt j|d|zt|jdt j|d|zfS)zExpands the box so it includes adjacent pixels that may be used by resampling with the given resampling filter. rLr1rr2r )_filters_supportrrrrImathceil) rrIrrfilter_supportscale_xscale_y support_x support_ys r% _get_safe_boxzImage._get_safe_box s*(3c9q6CF?d1g-q6CF?d1g-"W, "W,  3s1v )** + + 3s1v )** + +  ! diA(:;; < <  ! diA(:;; < <   r$(tuple[int, int] | list[int] | NumpyArray reducing_gap float | Nonec | tj}n|tjtjtjtjtjtjfvrd|d}dtjdftjdftjdftjdftjd ftjd ffD}|d d |dd d|d z }t|||dkrd}t|| d|j z}t|}|j |kr"|d|j zkr| S|j dvr tj}|j dvrd|tjkrT| ddd|j }||||}| |j S||9|tjkr(t!|d|dz |dz |z pd}t!|d|dz |dz |z pd} |dks| dkr||t%t||} || f} t'|jr|| | nt*|| | }|d| dz |z |d| dz | z |d| dz |z |d| dz | z f}|j d|j ddzkr|d|j dkrx|j|j d|df|d|d|j d|df}||||dd|d|df}n|j|||}||S)a Returns a resized copy of this image. :param size: The requested size in pixels, as a tuple or array: (width, height). :param resample: An optional resampling filter. This can be one of :py:data:`Resampling.NEAREST`, :py:data:`Resampling.BOX`, :py:data:`Resampling.BILINEAR`, :py:data:`Resampling.HAMMING`, :py:data:`Resampling.BICUBIC` or :py:data:`Resampling.LANCZOS`. If the image has mode "1" or "P", it is always set to :py:data:`Resampling.NEAREST`. Otherwise, the default filter is :py:data:`Resampling.BICUBIC`. See: :ref:`concept-filters`. :param box: An optional 4-tuple of floats providing the source image region to be scaled. The values must be within (0, 0, width, height) rectangle. If omitted or None, the entire source is used. :param reducing_gap: Apply optimization by resizing the image in two steps. First, reducing the image by integer times using :py:meth:`~PIL.Image.Image.reduce`. Second, resizing using regular resampling. The last step changes size no less than by ``reducing_gap`` times. ``reducing_gap`` may be None (no first step is performed) or should be greater than 1.0. The bigger ``reducing_gap``, the closer the result to the fair resampling. The smaller ``reducing_gap``, the faster resizing. With ``reducing_gap`` greater or equal to 3.0, the result is indistinguishable from fair resampling in most cases. The default value is None (no optimization). :returns: An :py:class:`~PIL.Image.Image` object. NUnknown resampling filter ().c6g|]}|dd|ddSr  (r)r#rr0s r%r6z Image.resize..K sA   !9,,q ,,,   r$Image.Resampling.NEARESTImage.Resampling.LANCZOSImage.Resampling.BILINEARImage.Resampling.BICUBICImage.Resampling.BOXImage.Resampling.HAMMING Use ,  or rMz#reducing_gap must be 1.0 or greaterr9rrrrrr1rr r2)rd)rErJrFrHrKrGrIrrfrIrrVr~rresizerhrrrr7reducerxrwrX) rrIrrrrfiltersrwfactor_xfactor_y reduce_boxfactors r%rz Image.resize sL  !)HH          N      =<<.transform sA% Aq!Q1q51q5=1$a!ea!ema&77 7r$r r4rN)r)rr rr rrryr*)rV transposer0r9rrr8r:rIrradiansr$cossinrrrfloorrrr>r?)rr rrrrrwrF post_transrrxxyyrr transformed_x transformed_ynwnhs r%rotatez Image.rotate sD  ) zzyy{{"||~~i&:;;; !!v!t{1J1J~~+0B;;I''I!eQU^Fe$$$ $(5//2 & & $(5//2 & &  48E??"B ' ' $(5//2 & &    8 8 8 8 )y AYJA & Z](BF  q 6!9 q VAY q VAY  BB!Q!Q!Q8 ) )1/8yAv/F/F, } -((( -((((3r77##djR&9&99B3r77##djR&9&99B $-9rAvY_Qi#ov#V#V F1IvayrqA~~ FI$fh)   r$rzStrOrBytesPath | IO[bytes]paramsc d}d}t|rtj|}d}nE|tjkr5t tjt jrtjj}|s=t|dr-t|j rtj|j }|rtntj |d}t |tr|n|}t#|st|t$vrt' t$|}n'#t($r}d|} t+| |d}~wwxYwddlm} t || jrZtj |tj |jkr|n||d d} ||_t=|d i} ||d |_ |!tDvrt'| s2| P|#d r;|!tHvr tH|!} ntD|!} d}|rbtj %| }|#d drtMj'|d}n6tMj'|d}n tQtRt|} | |||nM#tT$r@|r|+|r& tj,|n#tZ$rYnwxYwwxYw | |_.n #| |_.wxYw|r|+dSdS)a Saves this image under the given filename. If no format is specified, the format to use is determined from the filename extension, if possible. Keyword options can be used to provide additional instructions to the writer. If a writer doesn't recognise an option, it is silently ignored. The available options are described in the :doc:`image format documentation <../handbook/image-file-formats>` for each writer. You can use a file object instead of a filename. In this case, you must always specify the format. The file object must implement the ``seek``, ``tell``, and ``write`` methods, and be opened in binary mode. :param fp: A filename (string), os.PathLike object or file object. :param format: Optional format override. If omitted, the format to use is determined from the filename extension. If a file object was used instead of a filename, this parameter should always be used. :param params: Extra parameters to the image writer. These can also be set on the image itself through ``encoderinfo``. This is useful when saving multiple images:: # Saving XMP data to a single image from PIL import Image red = Image.new("RGB", (1, 1), "#f00") red.save("out.mpo", xmp=b"test") # Saving XMP data to the second frame of an image from PIL import Image black = Image.new("RGB", (1, 1)) red = Image.new("RGB", (1, 1), "#f00") red.encoderinfo = {"xmp": b"test"} black.save("out.mpo", save_all=True, append_images=[red]) :returns: None :exception ValueError: If the output format could not be determined from the file name. Use the format option to solve this. :exception OSError: If the file could not be written. The file may have been created, and may contain partial data. rFTrr zunknown file extension: Nrsave_all encoderinfor# append_imagesrzr+bzw+b)/rrsfspathrbstdoutrr TextIOWrapperbufferrdrrpathsplitextrrrrrqrrrfrrbabspathrvrkrhpop_default_encoderinfor_attach_default_encoderinfo encoderconfigupperrorrpexistsbuiltinsopenrrrreremovePermissionErrorr,)rrzr6r)rvopen_fp filename_extrrrrbr+r, save_handlercreateds r%rtz Image.save s\!# 2;; #y}}HGG 3:  *SZ9I"J"J "B *GB// *GBG4D4D *y))H  - IIII7++H55a8>>@@LlE22" ##%%%! 044  )## -"3 - - -666 oo1, -  dI/ 0 0 RW__ 6 6 W__T] + +6,6,  " " " " IIKKK::j$//$*!dM266  ((....0 <<>> % % FFF  0   ?++  (**#FLLNN3LL /L  %'..222Gzz(E** 4]8U33]8U33bi$$B + Lr8 , , , ,      Ih''''&D   - +D  {D  * * * *   HHJJJJJ  sZ E%% F /FF  NO&"O3OO OOOOO&& O/cHt|di}i|j||_|S)Nr,)rr6r,)rrwr,s r%r7z!Image._attach_default_encoderinfo s.dM266 Eb5EEr$framec4|dkrd}t|dS)a0 Seeks to the given frame in this sequence file. If you seek beyond the end of the sequence, the method raises an ``EOFError`` exception. When a sequence file is opened, the library automatically seeks to frame 0. See :py:meth:`~PIL.Image.Image.tell`. If defined, :attr:`~PIL.Image.Image.n_frames` refers to the number of available frames. :param frame: Frame number, starting at 0. :exception EOFError: If the call attempts to seek beyond the end of the sequence. rzno more images in fileN)EOFError)rrDrs r%seekz Image.seek s%$ A::*C3--  :r$titlec>ddlm}|||dS)a Displays this image. This method is mainly intended for debugging purposes. This method calls :py:func:`PIL.ImageShow.show` internally. You can use :py:func:`PIL.ImageShow.register` to override its default behaviour. The image is first saved to a temporary file. By default, it will be in PNG format. On Unix, the image is then opened using the **xdg-open**, **display**, **gm**, **eog** or **xv** utility, depending on which one can be found. On macOS, the image is opened with the native Preview application. On Windows, the image is opened with the standard PNG display utility. :param title: Optional title to use for the image window, where possible. r  ImageShowN)rrKshow)rrHrKs r%rLz Image.show s0( tU#####r$tuple[Image, ...]c||jjdkr|fSt t |j|jS)a Split this image into individual bands. This method returns a tuple of individual image bands from an image. For example, splitting an "RGB" image creates three new images each containing a copy of one of the original bands (red, green, blue). If you need only one band, :py:meth:`~PIL.Image.Image.getchannel` method can be more convenient and faster. :returns: A tuple containing bands. r )rhrwrrVrr_rXrrs r%rz Image.split sT 7=A  IIKK> !SDGMMOO44555r$channel int | strcP|t|trQ ||}n(#t $r}d|d}t ||d}~wwxYw||j|S)a@ Returns an image containing a single channel of the source image. :param channel: What channel to return. Could be index (0 for "R" channel of "RGB") or channel name ("A" for alpha channel of "RGBA"). :returns: An image in "L" mode. .. versionadded:: 4.3.0 zThe image has no channel ""N) rhrrr=rrfrXrwr4)rrOrrs r% getchannelzImage.getchannel s gs # # - ---////88 - - -=7=== oo1, -yy11222s'A A8A33A8cdS)z Returns the current frame number. See :py:meth:`~PIL.Image.Image.seek`. If defined, :attr:`~PIL.Image.Image.n_frames` refers to the number of available frames. :returns: Frame number, starting with 0. rr#rs r%tellz Image.tell s qr$rNr*c tttj| d fd }|}|dS|}d}|Ndt |d|zt |d|zf}||d}j|kr=||||} | j_|_ jj _ d_ dS) an Make this image into a thumbnail. This method modifies the image to contain a thumbnail version of itself, no larger than the given size. This method calculates an appropriate thumbnail size to preserve the aspect of the image, calls the :py:meth:`~PIL.Image.Image.draft` method to configure the file reader (where applicable), and finally resizes the image. Note that this function modifies the :py:class:`~PIL.Image.Image` object in place. If you need to use the full resolution image as well, apply this method to a :py:meth:`~PIL.Image.Image.copy` of the original image. :param size: The requested size in pixels, as a 2-tuple: (width, height). :param resample: Optional resampling filter. This can be one of :py:data:`Resampling.NEAREST`, :py:data:`Resampling.BOX`, :py:data:`Resampling.BILINEAR`, :py:data:`Resampling.HAMMING`, :py:data:`Resampling.BICUBIC` or :py:data:`Resampling.LANCZOS`. If omitted, it defaults to :py:data:`Resampling.BICUBIC`. (was :py:data:`Resampling.NEAREST` prior to version 2.5.0). See: :ref:`concept-filters`. :param reducing_gap: Apply optimization by resizing the image in two steps. First, reducing the image by integer times using :py:meth:`~PIL.Image.Image.reduce` or :py:meth:`~PIL.Image.Image.draft` for JPEG images. Second, resizing using regular resampling. The last step changes size no less than by ``reducing_gap`` times. ``reducing_gap`` may be None (no first step is performed) or should be greater than 1.0. The bigger ``reducing_gap``, the closer the result to the fair resampling. The smaller ``reducing_gap``, the faster resizing. With ``reducing_gap`` greater or equal to 3.0, the result is indistinguishable from fair resampling in most cases. The default value is 2.0 (very close to fair resampling while still being faster in many cases). :returns: None ryr,cd d}\jkr jkrdSjjz z kr|zfd n|z fd  fS) Nnumberr keyCallable[[int], float]ryrctttj|tj||dS)NrYr )rrrrr)rXrYs r% round_aspectzDImage.thumbnail..preserve_aspect_ratio..round_aspect= s63tz&1149V3D3D#NNNPQRRRr$c.t|z z Srr%)naspectrs r%z@Image.thumbnail..preserve_aspect_ratio..F s3vA~;N;Nr$r\c>|dkrdnt|z z SrGr_)r`rars r%rbz@Image.thumbnail..preserve_aspect_ratio..I s$166aas6APQE>?R?Rr$)rXr rYrZryr)rr)r]rarr provided_sizers @@@r%preserve_aspect_ratioz.Image.thumbnail..preserve_aspect_ratio< s S S S S!DAqDJ1 #3#3tZ$+-F1u LV1N1N1N1N1NOOO LJ$R$R$R$R$Ra4Kr$Nrr )rr)ryr,) rr_rrr/rrIrrwr<r~r;r?) rrIrrrepreserved_size final_sizerresrwrds ` @r% thumbnailzImage.thumbnail s Zc$*d3344        "/.00  ! F#   #**s47\122CQ,8N4O4OPC!f 9 " "ZsVVBeDG#DJDJ r$r 3Transform | ImageTransformHandler | SupportsGetDataSequence[Any] | Nonefillc 2|jdvrc|tjkrS|ddd|j|||||||jSt |t r|||||St|dr|\}}|d}t|t|j||}|jdkr%|j r|j |_ |j |_ |tjkr/|D]+\} } || |tj| ||du,n|d |z|||||du|S) ar Transforms this image. This method creates a new image with the given size, and the same mode as the original, and copies data to the new image using the given transform. :param size: The output size in pixels, as a 2-tuple: (width, height). :param method: The transformation method. This is one of :py:data:`Transform.EXTENT` (cut out a rectangular subregion), :py:data:`Transform.AFFINE` (affine transform), :py:data:`Transform.PERSPECTIVE` (perspective transform), :py:data:`Transform.QUAD` (map a quadrilateral to a rectangle), or :py:data:`Transform.MESH` (map a number of source quadrilaterals in one operation). It may also be an :py:class:`~PIL.Image.ImageTransformHandler` object:: class Example(Image.ImageTransformHandler): def transform(self, size, data, resample, fill=1): # Return result Implementations of :py:class:`~PIL.Image.ImageTransformHandler` for some of the :py:class:`Transform` methods are provided in :py:mod:`~PIL.ImageTransform`. It may also be an object with a ``method.getdata`` method that returns a tuple supplying new ``method`` and ``data`` values:: class Example: def getdata(self): method = Image.Transform.EXTENT data = (0, 0, 100, 100) return method, data :param data: Extra data to the transformation method. :param resample: Optional resampling filter. It can be one of :py:data:`Resampling.NEAREST` (use nearest neighbour), :py:data:`Resampling.BILINEAR` (linear interpolation in a 2x2 environment), or :py:data:`Resampling.BICUBIC` (cubic spline interpolation in a 4x4 environment). If omitted, or if the image has mode "1" or "P", it is set to :py:data:`Resampling.NEAREST`. See: :ref:`concept-filters`. :param fill: If ``method`` is an :py:class:`~PIL.Image.ImageTransformHandler` object, this is one of the arguments passed to it. Otherwise, it is unused. :param fillcolor: Optional fill color for the area outside the transform in the output image. :returns: An :py:class:`~PIL.Image.Image` object. rrr)rrlr3Nzmissing method datarr9)r~rErFrrrImageTransformHandlerrdr3rfrWr=rVr>r>rC_Image__transformerrB) rrIrrrrlrrrwrquads r%rzImage.transforme sv 9 & &8z7I+I+I D&99$)DEE4xyII##  f3 4 4 N##D$#MM M 69 % % ,!>>++LFD <'CS// ! D) , , 9   **,,BJ).."" Y^ # #!   T  y~tXyD?P     tVT8Y$=N    r$r>Sequence[float]c |d|dz }|d|dz }|tjkr |dd}n,|tjkr,|\} } } } | | z |z } | | z |z }tj}| d| d|| f}n|tjkr |dd}n|tjkr|dd}|dd}|dd}|dd}|\} } d|z }d|z }| |d| z |z|d| z |z|d|dz |dz | z|z|z| |d| z |z|d| z |z|d|dz |dz | z|z|zf}nd }t ||t jt jt j fvr|t j t j t j fvr6t j d t j d t j d i}||d |dz}nd|d}dt jdft jdft j dffD}|dd |ddd|dz }t ||||jdvr t j}|j||j||||dS)Nr1rr2r r5rr3rMzunknown transformation methodrrrrz) cannot be used.rrc6g|]}|dd|ddSrr#rs r%r6z'Image.__transformer.. sA!9,,q ,,,r$rrrrrrrr)r>r?r@rArBrfrErFrHrJrGrIrKrrhr~rwr)rrrrrrrlrrFr'r(r)r*xsysr%swseneAsAtrunusablers r% __transformerzImage.__transformer s- FSVO FSVO Y% % %8DD y' ' '!NBBr'QBr'QB%F2q"b)DD y, , ,8DD y~ % %bqbBacBacBacBFBqBqBAr!Ar!AAA&+r1B6Ar!Ar!AAA&+r1B6 DD2CS// !          JNJ,> @RSSSN$:&(B&(B, x(+K+K+K+KK@H@@@ ')CD(*EF')CDG E499WSbS\22EE EE ECS// !  : # #!)H #uxxFFFFFr$r0c|||j|S)a Transpose image (flip or rotate in 90 degree steps) :param method: One of :py:data:`Transpose.FLIP_LEFT_RIGHT`, :py:data:`Transpose.FLIP_TOP_BOTTOM`, :py:data:`Transpose.ROTATE_90`, :py:data:`Transpose.ROTATE_180`, :py:data:`Transpose.ROTATE_270`, :py:data:`Transpose.TRANSPOSE` or :py:data:`Transpose.TRANSVERSE`. :returns: Returns a flipped or rotated copy of this image. )rhrXrwr)rrs r%rzImage.transpose s3 yy**622333r$distancec|||j|S)zj Randomly spread pixels in an image. :param distance: Distance to spread pixels. )rhrXrw effect_spread)rr~s r%rzImage.effect_spread' s3 yy..x88999r$ImageQt.ImageQtc^ddlm}|jsd}t||j|S)z#Returns a QImage copy of this imager reQt bindings are not installed)rreqt_is_installedrtoqimagerrers r%rzImage.toqimage0 sE& #1Cc"" "w%%%r$ImageQt.QPixmapc^ddlm}|jsd}t||j|S)z$Returns a QPixmap copy of this imager rr)rrerr toqpixmaprs r%rzImage.toqpixmap9 sE& #1Cc"" " w &&&r$ryr)ryrA)rwrAryrryr)ryrLryr)r?rryr)rwrAryrx)ryrx)rr[ryr)NN)rlr5r6r5rmrryr)rr[ryr))rrarr)ryr)rrrrryr)ryr)ryr)ryr[r)rrryr)ryr)rrryrr)rrrrryr)r)rrryr)rrrrrrryr)ryr) r~r5rrrrr=rVrrryrx) rrrr+rrr=rrrPryrx)rrryrx)rwrArr"ryrA)r~r5rIr,ryr-)r0r1ryrx)ryr)r>r)ryr?)r)rBrryrC)rJr+ryrA)rJr+ryrO)ryrQryrU)ryrn)ryr)ryrg)r)rr5ryrryr))rrryr)ryr)rrrrryr)rrrrryr )rwrrrrrryr)r9r9)rwrxrrrrryr)rrr~r5ryrx)rrryr)rMr)rrr r r r ryr)rrrrryr)rrrrryr)rrrrryrx)rIrLrrErr"ryr)NNN) rIrrr+rrrrryrx)r r rr?ryrx)r r rrErrrrrr,rrryrx)rzr(r6r5r)rryr)rwrxryrU)rDrryr)rHr5ryr)ryrM)rOrPryrx)rIr*rrErrryr)rIrLrrjrrkrrrlrrrryrx)rrrrxrr>rrqrrrlr)ryr)rr0ryrx)r~rryrx)ryr)ryr)cr r!r"r%r6__annotations__r7!_close_exclusive_fp_after_loadingrpropertyrwsetterrrrIr~r?rXrZr]rerirkrxr~rrrrrrrrrrr}rrrhrrVrWrrPrTrrV__copy__r!r r/r0r=rArHr3rMrTrmrrrrr|rrrrrGrrrrrrrrrrrrrErFr'rtr7rGrLrrSrUrJrirrorrrrr#r$r%rxrxis   F%)))))(,%''''X YYXXXXBBBXB_"""_"         JJJJ( =A"                 9999((((   X ,,,, 15KKKKK MMMM    7 7 7 7 7 r     :")")")")")"V$$$$L      +/ $"; ~~~~~D! $. QQQQQf ) ) ) )H333334)))),    2%%%%62222-1++++++( #,,,,,22"&$ $ $ $ $%5%5%5%5N))))V :::: 77777,X*&&&&0 + + + +     PT#####DPT!!!!!>KO! Z'Z'Z'Z'Z'zPV6 6 6 6 6 B :7:7:7:7:7x5(5(5(5(t -----6.....`(+(+(+(+VOSXXXXXt    2 $8<%) nnnnnf15!6!6!6!6!6L *1"-1,0<@r r r r r jDHDDDDDL     ,$$$$$06666&3333,     *1%( TTTTTx&*"*<@\\\\\H#*TGTGTGTGTGl 4 4 4 4::::&&&&''''''r$c4eZdZdZejddZdS)rzb Used as a mixin by point transforms (for use with :py:meth:`~PIL.Image.Image.point`) rwrxrycdSrr#rEs r%rzImagePointHandler.pointM s r$N)rwrxryrx)r r!r"r%abcabstractmethodrr#r$r%rrG sB        r$rc4eZdZdZejd d Zd S) rnzi Used as a mixin by geometry transforms (for use with :py:meth:`~PIL.Image.Image.transform`) rIrLrrxrmrryc dSrr#)rrIrrms r%rzImageTransformHandler.transformX s  r$N)rIrLrrxrmrryrx)r r!r"r%rrrr#r$r%rnrnR sB        r$rnrIct|ttfsd}t|t |dkrd}t||ddks |ddkrd}t|dS)z Common check to enforce type and sanity check on size tuples :param size: Should be a 2 tuple of (width, height) :returns: None, or raises a ValueError zSize must be a list or tupler1z#Size must be a sequence of length 2rr zWidth and height must be >= 0N)rrdrrfr)rIrs r% _check_sizerf s| dT5M * *,oo 4yyA~~3oo Aw{{d1gkk-oo"kr$rcolorrct||4ttj||St |t rddlm}| ||}t}|dkrt |ttfrtd|Drtttdft|}t|dkst|dkr4dd lm}|j|_|j |}|tj|||S) a Creates a new image with the given mode and size. :param mode: The mode to use for the new image. See: :ref:`concept-modes`. :param size: A 2-tuple, containing (width, height) in pixels. :param color: What color to use for the image. Default is black. If given, this should be a single integer or floating point value for single-band modes, and a tuple for multi-band modes (one value per band). When creating RGB or HSV images, you can also use color strings as supported by the ImageColor module. See :ref:`colors` for more information. If the color is None, the image is not initialised. :returns: An :py:class:`~PIL.Image.Image` object. Nr rrc3@K|]}t|tVdSr)rrrs r%rznew.. s,22q 1c""222222r$.r2r3rU)rrxrXrrWrrrrrrdrallrrrrdr=rl)r~rIrrrw color_intsrds r%rWrWy sT( }ww||DHT400111%1 !     ##E400 B  utUm , ,  22E222 2 2 '+5c?E%LL&I&I z??a  3z??a#7#7 & & & & & &2244BJJ'' 33E 7749T4// 0 00r$rrLrrc*t|t||}|jdkrh|jdkr]|}t |dkr#t |dt r|d}|dkr|dkr|}|||||S)a Creates a copy of an image memory from pixel data in a buffer. In its simplest form, this function takes three arguments (mode, size, and unpacked pixel data). You can also use any pixel decoder supported by PIL. For more information on available decoders, see the section :ref:`Writing Your Own File Codec `. Note that this function decodes pixel data only, not entire images. If you have an entire image in a string, wrap it in a :py:class:`~io.BytesIO` object, and use :py:func:`~PIL.Image.open` to load it. :param mode: The image mode. See: :ref:`concept-modes`. :param size: The image size. :param data: A byte buffer containing raw data for the given mode. :param decoder_name: What decoder to use. :param args: Additional parameters for the given decoder. :returns: An :py:class:`~PIL.Image.Image` object. rr rr#)rrWrrrrrr)r~rIrrrrwrs r%rr s< T4B x1}}a |   ! !ja%&H&H !'?L 5 \R%7%7L T<666 Ir$bytes | SupportsArrayInterfacec t|t|dkr#t|dtr|d}|dkr|dkr|ddf}|dtvr~t |d}|tj|||d|}|dkr4ddl m }|j d|j d|_ d|_|St|||||S) a Creates an image memory referencing pixel data in a byte buffer. This function is similar to :py:func:`~PIL.Image.frombytes`, but uses data in the byte buffer, where possible. This means that changes to the original buffer object are reflected in this image). Not all modes can share memory; supported modes include "L", "RGBX", "RGBA", and "CMYK". Note that this function decodes pixel data only, not entire images. If you have an entire image file in a string, wrap it in a :py:class:`~io.BytesIO` object, and use :py:func:`~PIL.Image.open` to load it. The default parameters used for the "raw" decoder differs from that used for :py:func:`~PIL.Image.frombytes`. This is a bug, and will probably be fixed in a future release. The current release issues a warning if you do this; to disable the warning, you should provide the full set of parameters. See below for details. :param mode: The image mode. See: :ref:`concept-modes`. :param size: The image size. :param data: A bytes or other buffer object containing raw data for the given mode. :param decoder_name: What decoder to use. :param args: Additional parameters for the given decoder. For the default encoder ("raw"), it's recommended that you provide the full set of parameters:: frombuffer(mode, size, data, "raw", mode, 0, 1) :returns: An :py:class:`~PIL.Image.Image` object. .. versionadded:: 1.1.4 r rrr#r9rrUr)rrrr _MAPMODESrWrXr map_bufferrrdrwr|r=r?r)r~rIrrrrwrds r% frombufferr sP 4yyA~~*T!We44~Awu 2::A:D 7i  T6""Bt\1dKKLLBs{{******6\6ube>N>Nu>U>UVV BKI T4|T : ::r$c2eZdZdZeddZd dZdS) SupportsArrayInterfacezC An object that has an ``__array_interface__`` dictionary. ryrUctrNotImplementedErrorrs r%rz*SupportsArrayInterface.__array_interface__ s!###r$rctrrrs r%__len__zSupportsArrayInterface.__len__ s!###r$Nrr)r r!r"r%rrrr#r$r%rr sR$$$X$$$$$$$r$rceZdZdZ dd dZdS) SupportsArrowArrayInterfacezm An object that has an ``__arrow_c_array__`` method corresponding to the arrow c data interface. Nr 'PyCapsule'rytuple['PyCapsule', 'PyCapsule']ctrrrs r%rz-SupportsArrowArrayInterface.__arrow_c_array__, s"###r$r)rrryr)r r!r"r%rr#r$r%rr& s< /3$$$$$$$r$robjr5c 6|j}|d}t|}|dd} d|ddz|df}n0#t$r#}|d}g}nd} t | |Yd}~nd}~wwxYw|B t |\} } }n/#t$r"}|\} } d| d | } t | |d}~wwxYw||| kr||vrt d d |} n| }|d vrd}n |d krd}nd}||krd|d|d} t| |dkrdn|d|df}|[t|dr| }n6t|dr| }nd} t| t|||d| ddS)a2 Creates an image memory from an object exporting the array interface (using the buffer protocol):: from PIL import Image import numpy as np a = np.zeros((5, 5)) im = Image.fromarray(a) If ``obj`` is not contiguous, then the ``tobytes`` method is called and :py:func:`~PIL.Image.frombuffer` is used. In the case of NumPy, be aware that Pillow modes do not always correspond to NumPy dtypes. Pillow modes only offer 1-bit pixels, 8-bit pixels, 32-bit signed integer pixels, and 32-bit floating point pixels. Pillow images can also be converted to arrays:: from PIL import Image import numpy as np im = Image.open("hopper.jpg") a = np.asarray(im) When converting Pillow images to arrays however, only pixel values are transferred. This means that P and PA mode images will lose their palette. :param obj: Object with array interface :param mode: Optional mode to use when reading ``obj``. Since pixel values do not contain information about palettes or color spaces, this can be used to place grayscale L mode data within a P mode image, or read RGB data as YCbCr for example. See: :ref:`concept-modes` for general information about modes. :returns: An image object. .. versionadded:: 1.1.6 rstridesNrr1rzCannot handle this data typezCannot handle this data type: rz('mode' parameter for changing data typesr)rrrrrrr2r3zToo many dimensions: z > rr rr}tostringz1'strides' requires either tobytes() or tostring()r) rrrrr8_fromarray_typemaprrfrdr}rr)rr~rrndimrtypekeyr color_modesrtypemoder typekey_shaperndmaxrIs r% fromarrayr2 s3L  !C LE u::Dggi&&G(59$c)n4 (((  G%'KK0CC..a ' KKKK( (-?-H *Hg{{ ( ( (%, "M7M=MMGMMCC..a ' (  8  K 7 7 @" E E E (((  e||7d77u777oo 11uQxq 1D 3 " " "++--CC S* % % ",,..CCECS// ! dD#ugq! < <u2r)rzi2zI;16BS)rzu4zI;32B)rzi4zI;32BS)rzf4zF;32BF)rzf8zF;64BF))r r r1rrrr))r r r2rr)rrr))r r r3rr)rrrri4f4c4tdStd|dtd|dz}|dtzkr d|ddtzd}t||tkr(tjd|dtdt dSdS)Nr rr1z Image size (z pixels) exceeds limit of z0 pixels, could be decompression bomb DOS attack.)r,rr(rrr)rIpixelsrs r%r&r& s DG__s1d1g .F $$$$ >6 > >QAQ=Q > > > %S)))      66 6 6=M 6 6 6 $     ! r$rrzr( Literal['r']formats"list[str] | tuple[str, ...] | Nonec  |dkr!dt|}t|t|tjrd}t||t }n-t|t tfsd}t|d d}t|r,tj |}tj |d}d n ttt |} |d nD#t$tjf$r+tj|}d YnwxYw|d }|r%tj|d nd}t1|st3g d fd }|||||}|n|t uret2t4fD]V} t  | | kr+||||t fd|D}|nW|r |_|S r| D]} t=j| d|r|n|z}tA|)a Opens and identifies the given image file. This is a lazy operation; this function identifies the file, but the file remains open and the actual image data is not read from the file until you try to process the data (or call the :py:meth:`~PIL.Image.Image.load` method). See :py:func:`~PIL.Image.new`. See :ref:`file-handling`. :param fp: A filename (string), os.PathLike object or a file object. The file object must implement ``file.read``, ``file.seek``, and ``file.tell`` methods, and be opened in binary mode. The file object will also seek to zero before reading. :param mode: The mode. If given, this argument must be "r". :param formats: A list or tuple of formats to attempt to load the file in. This can be used to restrict the set of formats checked. Pass ``None`` to try all supported formats. You can print the set of available formats by running ``python3 -m PIL`` or using the :py:func:`PIL.features.pilinfo` function. :returns: An :py:class:`~PIL.Image.Image` object. :exception FileNotFoundError: If the file cannot be found. :exception PIL.UnidentifiedImageError: If the image cannot be opened and identified. :exception ValueError: If the ``mode`` is not "r", or if a ``StringIO`` instance is used for ``fp``. :exception TypeError: If ``formats`` is not ``None``, a list or a tuple. rz bad mode zKStringIO cannot be used to open an image. Binary data must be used instead.Nzformats must be a list or tupleFrrbTrr rz IO[bytes]rvrprefixrrlist[str] | tuple[str, ...]ryImageFile.ImageFile | Nonecr|D]1}|}|tvrt t|\}}| p ||}t|tr |n;|r9|d|||}t|j|cS#ttttj f$r:} tr( |dzt | zYd} ~  d} ~ wt$r r|wxYwdS)Nrz opening failed. )r9rlrrrrrGr&rI SyntaxError IndexErrorr8structerrorr* BaseExceptionre) rzrvrrrfactoryacceptrrwr exclusive_fpwarning_messagess r% _open_corezopen.._open_coreLsU   A A}} "&q'#5vvf~~fc**$++F3333GGAJJJ X..B-bg666IIIY E N N N(N$++A0C,Cc!ff,LMMM    HHJJJ tsBB88"D4/D%D4c3$K|] }|v|V dSrr#)rrwchecked_formatss r%rzopen..us-II0H0H!0H0H0H0HIIr$zcannot identify image file %r) rzrrvrrrrrryr)!reprrfrrStringIOrkrdrr8rrsr.r;r<rrrrGrUnsupportedOperationrreadr2r3rrrrV _exclusive_fprerrr )rzr~rrrvrrrrwloadermessagerrrs @@@r%r<r<sD s{{&$t**&&oo B $ $ 0 oo $ / //nnLHr{{!9R== ]8T * * "U)R   B3 4 Z " " WWR[[F,4 ;"'  8 $ $Q ' 'C ' , , "$: B&' 2 2B zgmmo  F ggiiO FHHH/))ZIIIIWIIIII  >E '   # g )-IXXr JC  % %%s-D>EEim1im2c|||tj|j|jS)z Alpha composite im2 over im1. :param im1: The first image. Must have mode RGBA or LA. :param im2: The second image. Must have the same mode and size as the first image. :returns: An :py:class:`~PIL.Image.Image` object. )rhrXrrrw)rrs r%rrsAHHJJJHHJJJ 88D(88 9 99r$rr c|||tj|j|j|S)a Creates a new image by interpolating between two input images, using a constant alpha:: out = image1 * (1.0 - alpha) + image2 * alpha :param im1: The first image. :param im2: The second image. Must have the same mode and size as the first image. :param alpha: The interpolation alpha factor. If alpha is 0.0, a copy of the first image is returned. If alpha is 1.0, a copy of the second image is returned. There are no restrictions on the alpha value. If necessary, the result is clipped to fit into the allowed output range. :returns: An :py:class:`~PIL.Image.Image` object. )rhrXrblendrw)rrrs r%rrsB$HHJJJHHJJJ 88DJsvsvu55 6 66r$image1image2rc\|}||d||S)af Create composite image by blending images using a transparency mask. :param image1: The first image. :param image2: The second image. Must have the same mode and size as the first image. :param mask: A mask image. This image can have mode "1", "L", or "RGBA", and must have the same size as the other two images. N)rVr)rrrrs r% compositers, KKMME KKd### Lr$rrZc8||dS)a Applies the function (which should take one argument) to each pixel in the given image. If the image has more than one band, the same function is applied to each band. Note that the function is evaluated once for each possible pixel value, so you cannot use random components or other generators. :param image: The input image. :param function: A function object, taking one integer argument. :returns: An :py:class:`~PIL.Image.Image` object. r)r)rrs r%evalrs ;;tAw  r$rSequence[Image]ct|t|ksd|vrd}t||ddD]R}|jt |krd}t||j|djkrd}t|S|D]}||dtj |gd|DRS) am Merge a set of single band images into a new multiband image. :param mode: The mode to use for the output image. See: :ref:`concept-modes`. :param bands: A sequence containing one single-band image for each band in the output image. All bands must have the same size. :returns: An :py:class:`~PIL.Image.Image` object. *zwrong number of bandsr Nz mode mismatchrz size mismatchcg|] }|j Sr#)rw)rrs r%r6zmerge..s+@+@+@QAD+@+@+@r$) rrrfr~rrIrhrXrr)r~rrrJs r%rrsDSZZ''3$;;%ooabb "" 9 D)) ) )!CS// ! 9a % %!CS// ! & 8==DA+@+@%+@+@+@AAA B BBr$rrSCallable[[IO[bytes], str | bytes], ImageFile.ImageFile] | type[ImageFile.ImageFile]r$Callable[[bytes], bool | str] | Nonec|}|tvrt|||ft|<dS)a1 Register an image file plugin. This function should not be used in application code. :param id: An image format identifier. :param factory: An image file factory method. :param accept: An optional function that can be used to quickly reject images having another format. N)r9rkrrl)rrrs r% register_openrs:" B || " DHHHr$mimetypec>|t|<dS)a Registers an image MIME type by populating ``Image.MIME``. This function should not be used in application code. ``Image.MIME`` provides a mapping from image format identifiers to mime formats, but :py:meth:`~PIL.ImageFile.ImageFile.get_format_mimetype` can provide a different result for specific images. :param id: An image format identifier. :param mimetype: The image MIME type for this format. N)rnr9)rrs r% register_mimers Dr$driver/Callable[[Image, IO[bytes], str | bytes], None]c>|t|<dS)z Registers an image save function. This function should not be used in application code. :param id: An image format identifier. :param driver: A function to save images in this format. N)ror9rrs r% register_saver sDr$c>|t|<dS)z Registers an image function to save all the frames of a multiframe format. This function should not be used in application code. :param id: An image format identifier. :param driver: A function to save images in this format. N)rpr9r s r%register_save_allr "s"HRXXZZr$ extensioncb|t|<dS)z Registers an image extension. This function should not be used in application code. :param id: An image format identifier. :param extension: An extension used for this format. N)r9rqr)rr s r%register_extensionr0s&$&88::Iioo   r$ extensionsc0|D]}t||dS)z Registers image extensions. This function should not be used in application code. :param id: An image format identifier. :param extensions: A list of extensions used for this format. N)r)rrr s r%register_extensionsr;s0 ** 2y))))**r$c,ttS)za Returns a dictionary containing all file extensions belonging to registered plugins )rrqr#r$r%registered_extensionsrGs  FFF r$rrtype[ImageFile.PyDecoder]c|t|<dS)z Registers an image decoder. This function should not be used in application code. :param name: The name of the decoder :param decoder: An ImageFile.PyDecoder object .. versionadded:: 4.1.0 N)rr)rrs r%register_decoderrPHTNNNr$rtype[ImageFile.PyEncoder]c|t|<dS)z Registers an image encoder. This function should not be used in application code. :param name: The name of the encoder :param encoder: An ImageFile.PyEncoder object .. versionadded:: 4.1.0 N)rs)rrs r%register_encoderr]rr$rmc Pddlm}tddd|j|fi|dS)Nr rJz Image._showrzImageShow.show)rrKrrL)rrmrKs r%_showrnsG mR!1222IN5$$G$$$$$r$extentr"qualityclttj|||S)a Generate a Mandelbrot set covering the given extent. :param size: The requested size in pixels, as a 2-tuple: (width, height). :param extent: The extent to cover, as a 4-tuple: (x0, y0, x1, y1). :param quality: Quality. )rxrXreffect_mandelbrot)rIrrs r%r!r!ys) 77<<.tVWEE F FFr$sigmacjttj||S)z Generate Gaussian noise centered around 128. :param size: The requested size in pixels, as a 2-tuple: (width, height). :param sigma: Standard deviation of noise. )rxrXr effect_noise)rIr"s r%r$r$s' 77<<)$66 7 77r$chttj|S)zl Generate 256x256 linear gradient from black to white, top to bottom. :param mode: Input mode. )rxrXrlinear_gradientrs r%r&r&% 77<<,T22 3 33r$chttj|S)zm Generate 256x256 radial gradient from black to white, centre to edge. :param mode: Input mode. )rxrXrradial_gradientrs r%r)r)r'r$envdict[str, str] | Nonec"||n tj}dtjfdtjfdtjffD]\}}||vr ||}d}dD]4\}}||r|}|dt| }5 t||z}n'#t$rtj |dYwxYw ||#t$r#} tj |d| Yd} ~ d} ~ wwxYwdS)NPILLOW_ALIGNMENTPILLOW_BLOCK_SIZEPILLOW_BLOCKS_MAXr ))r`i)riz is not intz: ) rsenvironr set_alignmentset_block_sizeset_blocks_maxrrprrrfrr) r*env_dictvar_namervarunitspostfixmulvar_intrs r%_apply_env_variablesr;sross2:H T/0 d12 d12..& 8 # # x &&((= + +LGS||G$$ +/S\\M/* #hh&GG    MX222 3 3 3 H  . F7OOOO . . . MX,,,, - - - - - - - - .1..s*B++!CC C D )DD ceZdZUdZdZded<dZdZd-dZd.d Z d/dZ d0d1dZ d2dZ d3dZ d0d4dZd5dZd6d7dZd8d Zd-d!Zd9d#Zd:d$Zd;d%Zdd*Zd?d,ZdS)@rna This class provides read and write access to EXIF image data:: from PIL import Image im = Image.open("exif.png") exif = im.getexif() # Returns an instance of this class Information can be read and written, iterated over or deleted:: print(exif[274]) # 1 exif[274] = 2 for k, v in exif.items(): print("Tag", k, "Value", v) # Tag 274 Value 2 del exif[274] To access information beyond IFD0, :py:meth:`~PIL.Image.Exif.get_ifd` returns a dictionary:: from PIL import ExifTags im = Image.open("exif_gps.jpg") exif = im.getexif() gps_ifd = exif.get_ifd(ExifTags.IFD.GPSInfo) print(gps_ifd) Other IFDs include ``ExifTags.IFD.Exif``, ``ExifTags.IFD.MakerNote``, ``ExifTags.IFD.Interop`` and ``ExifTags.IFD.IFD1``. :py:mod:`~PIL.ExifTags` also has enum classes to provide names for data:: print(exif[ExifTags.Base.Software]) # PIL print(gps_ifd[ExifTags.GPS.GPSDateStamp]) # 1999:99:99 99:99:99 Nr5ryFryrcLi|_i|_i|_d|_d|_dSr)_data _hidden_data_ifds_info _loaded_exifrs r%rz Exif.__init__s-%' ,.02 CG *.r$rrc t|dkrt|tr|dSn#t$rYnwxYw|Sr,)rrrr)rrs r%_fixupz Exif._fixupsS 5zzQ:eU#;#;Qx    D  s/3 AAsrc_dictdict[int, Any]cDfd|DS)NcBi|]\}}||Sr#)rD)rr`rrs r%raz$Exif._fixup_dict.. s)???da4;;q>>???r$)rc)rrEs` r% _fixup_dictzExif._fixup_dicts*@???hnn.>.>????r$r rgroupr+dict[int, Any] | Nonec |j|ddlm}|j|j|}||j|t|S#ttf$rYdSwxYw)Nr rr)rJ) rzrGrrfImageFileDirectory_v2headrhrIdictrr8)rr rJrfr>s r% _get_ifd_dictzExif._get_ifd_dict s 0 GLL  * ) ) ) ) )8?8%PPPD IIdg   ##DJJ// /)$   44 sA55B  B rc|jrdnd}|jdkrd|zdztdz}nd|ztdz}|jr1||jdkrtdntdz }|dz }|S) N+*rusIIrsMMs)rwryrr)rrrNs r% _get_headzExif._get_heads!\6''w ;#  7?W,uQxx7DDw&q1D < (  s 2 2E!HHHa @D ' 'D r$rc||jkrdS||_|j|j|j|r6|dr!|dd}|r|d!|s d|_dStj||_ |j d|_ ddl m }|j|j |_|jj|_|j |jj|j|j dS)NExifr5rr rr)rBr>clearr?r@rrArrrzrrNrrfrMrxryrGnextrh)rrrfs r%rhz Exif.load'sA 4$ $ $ F   !!!  t77 8D t77  DJ FZ--GLLOO %%%%%%:_:49EE j(   TZ_%%%      r$rzrc^d|_|j|j|jddlm}||_|||_ n|j d|_ |j |j |_ |j |j j|_ | |j j}|j|j||j |jdS)Nr rrr)rBr>rXr?r@rrfrzrUrNrrMrAryrxrYrUrGrh)rrzr rfs r%r{zExif.load_from_fpDs   !!!  &%%%%%  ((DII QDI:_:49EE ; *,DK >Z_F    V      r$ct|}tjj|vrQ||tjjtjj}|r||tjj|vrL||tjjtjj|tjj<|Sr)rOr IFDrnrPupdateGPSInfo)r merged_dictifds r%_get_merged_dictzExif._get_merged_dict[s4jj  <  $ $$$T(,*;%OPPC (""3''' < 4 ' '040B0BX\)*HL,@11K , -r$rcddlm}|}|j|}|jD]\}}||vr|||<|D]\}}|t jjt jj fvrt|ts| |}|t jjkrt jj |vrtt|t jj tsJ|}| t jj |t jj <|||<d|z||zS)Nr rr)ifhrW)rrfrUrMr@rcr r\rnr^rrOget_ifdInteroprVr})rr rfrNr`rWifd_dictrs r%r}z Exif.tobyteslsb%%%%%%~~3o3===!Z--// $ $MC$#C**,,  JC ! $!-- S))8<,,, ,55&uX\-A'BDII6"JJLLE26,,x|?S2T2TE(,./CHH% F(;(;;;r$rWc  ||jvr+|tjjkrD|j;|jjdkr+||jj}| ||j|<n|tjjtjjfvrT|j || |}|"|||}| ||j|<nZ|tjj tjj fvr5tjj|jvr$| tjj|jtjj|}|tjj krddlm} |drgt#|d}||d}i}t%t'jd|dddD]} t'jd|| d zdz| dzd zdz\} } } } |j| \}}n#t,$rYQwxYw| |z}|d kr+t'jd | \}||d z ||zd z } n | d|} t/| |kr+t1jd |d t/| d| | s||| d|| <t5|||j|<n| ddkri}t%t'jd|dddD]} t'jd|| d zdz| dzd zdz\} } } } | dkrrt'jd| \}|j|d|jd i}|jd t#|jd |d<|jd |jd |d<|jd |jd }|jt>j d}|||dd|d<|jd |jd|d<d|i}||j|<n7#t&j!$rYn&wxYw|||}| ||j|<|j"|i}|tjjkr%|j rd|#D}|S)Nrr )rMsFUJIFILMrzHz>HHL4siz>LModelID TimeStampInternalSerialNumberParallaxCategorycbi|],\}}|tjjtjjfv)||-Sr#)r r\re MakerNote)rr`rs r%raz Exif.get_ifd..sBQX\18<3IJJJ1JJJr$)$r@r r\IFD1rArYrPrnr^r?rrerprdrfrMrrrrunpack_load_dispatchrrrrrOrIrzrGrr FLOATr setdefaultrc)rrWr`r tag_datarM ifd_offsetifd_data makernoterifd_tagtypcountr unit_sizehandlerrI camerainfoparallaxs r%rdz Exif.get_ifds dj hl''':)djo.B.B,,TZ_==C*- 3*HL,@AAA*..sDHHSMMBB%,,VS99C*- 3-x|/EFFF<$DJ66LL!2333:hl&78=(,000FFFFFFL#..{;;I8).x););J'/ '(LS(Q%&(1(/'/!-!-!-$,H!-',y'8#'!8806 dD0I0IIV+3FRK&4-RTBT4T+UDD+/;D#&t99#4#4$,M)O=A)O)O+.t99)O)OEL)O)O%&%&%& %-'+!-$,5CDGLLQSDTDT>U>UJ{$;$(GLLOOOIMVWJ/E$F$(GLL$4$4$4/3w||AH.C.R(0/&&'/)G>EW(=(=(?(?5>&>&&'>)Jz$:%)GLLOOO=AW\\!__Jz$:170DI.7DJsO!<,,Xs;;C*- 3j##C,, (,# # #(9 #!iikkC  s8rs r%__str__z Exif.__str__s4 : !z  S 4:r$ct|j}|j||jt |Sr)setr>rAr]rrkeyss r%rz Exif.__len__s74: : ! KK # # #4yyr$c|jB||jvr9||jvr0||j||j|<|j|=|j|Sr)rAr>rDrs r% __getitem__zExif.__getitem__sT : !c&;&;tz@Q@Q"kk$*S/::DJsO 3z#r$r[r)c8||jvp|jduo||jvSr)r>rArs r% __contains__zExif.__contains__ s'dj RTZt%;%Qtz@QRr$cJ|j||jvr|j|=||j|<dSr)rAr>)rrWrs r% __setitem__zExif.__setitem__s. : !cTZ&7&7 3 3r$cp|j||jvr |j|=dS|j|=||jvr |j|=dSdSr)rAr>r@rs r% __delitem__zExif.__delitem__sN : !cTZ&7&7 3 3dj  JsOOO! r$ Iterator[int]ct|j}|j||jt |Sr)rr>rAr]iterrs r%__iter__z Exif.__iter__s74: : ! KK # # #Dzzr$r)rrryr)rErFryrFr)r rrJr+ryrK)ryr)rrryr)rzrr r+ryr)ryrF)r)r rryr)rWrryrFrr)rWrryr)rWr[ryr))rWrrrryr)rWrryr)ryr)r r!r"r%ryrrwrsrrDrIrPrUrhr{rar}rdrrrrrrrrr#r$r%rnrnsBFGG////@@@@ 0400000    !!!!:!!!!!."<<<<<0mmmm^   SSSS    $$$$r$rn)rwrxryrz)r~rryr)r~rryr)r~rryr)rrryr)rr)r#) r~rrrrrrrryr) r~rrrrrrrryr)r(r)ryr*)rIrryr)r)r~rrIrrrryrxr) r~rrIrLrrrrrrryrx) r~rrIrLrrrrrrryrxr)rrr~r5ryrx)rrr~rrIrLryrx)rwrryr)rwrryr)rIrLryr)rN)rzr(r~rrrryr)rrxrrxryrx)rrxrrxrr ryrx)rrxrrxrrxryrx)rrxrrZryrx)r~rrrryrx)rrrrrrryr)rrrrryr)rrrrryr)rrr rryr)rrrrjryr)ryrm)rrrrryr)rrrrryr)rrxrmrryr)rIrLrr"rrryrx)rIrLr"r ryrx)r~rryrx)r*r+ryr) __future__rratexitr;rloggingrrsrYrrbrqrcollections.abcrenumrtypingrrrrr r r r rr_binaryrrr _deprecater_utilrrr defusedxmlrr TYPE_CHECKINGrrrtypesrrr getLoggerr rRuntimeWarningrrr(r*rr,r-rrrrrrrr0r>rErGrHrIrJrKrrPrVrZmodulesmoduleitemsetattrrrrdr_FILTERED HUFFMAN_ONLYRLEFIXEDmmapxml.etree.ElementTreer`IPython.lib.prettyrarbrcrdrerf_typingrgrhrirkrlrnrorprqrrrs byteorder_ENDIANrMODESrrrrrrrrrrrrr r.r0rxABCrrnrrWrrrrr memoryviewrrrrrrrr&r<rrrrrrrr r rrrrrrr!r$r&r)r;register clear_cache _ExifBasernr#r$r%rs`6#""""""   ******%%%%%%%%%% )(((((((((!!!!!!))))))))&&&&&&&KKK $<<<<<<<<<<      ########  8 $ $     ~        Y   $#### #s#?@@@@@@ #"""""ggd$4d;;;; -$WT+;TBB - -* - - k# <    s1vv/00 .  M      Q  3 4 4. cc!ffn---  ,        NC Wg w X   :vw I//D// 4:..../ 74#$$,}H$L (C JE  AKKK------000000PPPPPPPPPPPPPP@@@@@@@@@@ CEEEEEGIIIII 133333133333 (**##   2 I  , , , , , , , , ) ) ) ).... K% K% K%  K%   K%   K% K% K% K% K% K% K% K% K% K%" #K%$ %K%& 'K%K%( ")K%* +K%, -K%. /K%0 1K%2 3K%4 5K%6 7K%8 9K%: ;K%< =K%> ?K%@ AK%B CK%D "EK%F GK%H !IK%K%K%J KK%L MK%N ?OK%P QK%R SK%T UK%V WK%X YK%Z [K%\ ]K%^ _K%` aK%b cK%d eK%f gK%h iK%j kK%K%K%l mK%n oK%p qK%r sK%t uK%v wK%x yK%z {K%| }K%~ K%@ AK%B CK%D EK%F GK%H IK%J KK%L MK%K%N    UK%K%K%KKKK\0****Z>GI(((((4GI(((((:'L'L'L'L'L'L'L'LTQQQQ.....h... W''W''W''W''W''W''W''W''|N              CG    (,56.1.1.1.1.1j +++++d ;;;;;;;;;;| $ $ $ $ $X $ $ $y :-0FF  $ $ $ $ $( $ $ $T=T=T=T=T=n1111h""""####c5"%c3&  c5"%  c62& c7B'c7B'c8R(c62&c7B'c7B'c8R(c7B'c8R( c7B'!"c8R(#$tdD\2%&'>'>'>?'()A)A)AB ^^^sCn ^^^sCn/6    .26B&B&B&B&B&R : : : :7777."     CCCCJ48 .          " " " ".... * * * *        "%%%% G G G G888844444444.....> !!!sCx(IIIOOOOO9OOOOOs+<BB  B 05D&&F+A)FF