Files
intellecton/venv/lib/python3.12/site-packages/PIL/__pycache__/Image.cpython-312.pyc
T

1730 lines
176 KiB
Plaintext
Raw Normal View History

Ë
ß¼j Xã
óê 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(dZ*e*rddlm+Z+m,Z,m-Z-ddl.m/Z/ddlm0Z0m1Z1ejde3«Z4Gdde5«Z6Gdde7«Z8dZ9de&d<e:d«Z;de&d< ddlm<Z=ee>e=dd«k7rde>e=dd«deZ?e)e?« Gd"„d#e«ZDGd$„d%e«ZEGd&„d'e«ZFeFjŽd(eFjd)eFjd)eFj”d*eFjd+iZLGd,„d-e«ZMGd.„d/e«ZNGd0„d1e«ZOe j e3ZQeDeEeFeMeNeOfD]'ZeD] ZReSeQeRj¨eRjª«Œ"Œ)eVe=d2«r<e=j®ZWe=j°ZXe=j²ZYe=j´ZZe=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 dEk(rdFndGZsd#dI„ZtgdJ¢ZudKZvd$dL„Zwd$dM„Zxd%dN„Zyd&dO„Zzda{idPdQ“dRdQ“dSdT“dUdV“dWdV“dXdV“dYdV“dZd[“d\d[“d]d[“d^d[“d_d[“d`da“dbda“dcdd“dedd“dfdg“idhdi“djdk“dldm“dndo“dpdq“drdq“dsdt“dudt“dvdw“dxdw“dydz“d{d|“d}d|“d~dd€dddƒ“d„dƒ“¥id…d†“d‡dˆ“d‰dŠ“d‹dŒ“ddŽ“ddŽ“ddŽ“d‘dŽ“d’dŽ“d“dŽ“d”d•“d–d—“d˜d—“d™dš“d›dœ“ddž“dŸd “¥id¡d¢“d£d¤“d¥d¦“d§d¨“d©dª“d«d¬“d­d¬“d®d¬“d¯d¬“d°d±“d²d³“d´d³“dµd³“d¶d³“d·d¸“d¹d¸“dºd»“¥d¼d¼d½d¾d¿œ¥Z|d;e&dÀ<d'dÁ„Z}d(d„Z~d)dÄZ d* d+dÄ„Z€ d* d,dÅ„ZGdÆ„dÇ«Z d-dÈ„GdÉ„dÊe«Z„GdË„dH«Z…GdÌ„dÍej «Z‡Gd΄dÏej «Zˆd.dЄZ‰ d/ d0dÑ„d1 d2dÒ„Z d1 d3dÓ„GdÔ„dÕe«ZGdÖ„d×e«d4d5dØ„Z d6dÙ„Zd7dÚ„Zd8dÛ„ZidÜdÝdÞgfdßdàdàdágfdâdãdägfdådãdægfdçdãdègfdédãdêgfdëdãdìgfdídãdîgfdïdãdðgfdñdãdògfdódãdôgfdõdöd÷gfdødödùgfdúdödûgfdüdödýgfdþdÿdÿddgfdddgd¢fdddgd¢fdesd fdãdãgfdesd
fdödögfi¥Z“d9d Z” d: d;d Z•d<d
Zd=dZ—d>dZ˜d?dZ™d@dd4 dAdZdBd dCdZ dCddDddEdZ dFddGddHddId dJddKddLddLdd4dMd „e©«ejTe=jV«e*ree:e0fZ¬neGd!„d"e¬«Z­y#e)$rdZ(YŒ†wxYw#e)$raZ@eAe@«j…d«re
j†d e5«eAe@«j…d!«re
j†eAe@«e5«dZ@[@wwxYw(Né)Ú annotationsN)ÚMutableMapping)ÚIntEnum)ÚIOÚProtocolÚcasté)ÚExifTagsÚ ImageModeÚTiffTagsÚUnidentifiedImageErrorÚ __version__Ú_plugins)Úi32leÚo32beÚo32le)Ú deprecate)Ú
DeferredErrorÚis_pathzModuleType | NoneÚ ElementTree)rF)ÚCallableÚIteratorÚSequence)Ú
ModuleType)ÚAnyÚLiteralcó eZdZy)ÚDecompressionBombWarningN©Ú__name__Ú
__module__Ú __qualname__©óúL/home/antigravity/intellecton/venv/lib/python3.12/site-packages/PIL/Image.pyrrKóØr$rcó eZdZy)ÚDecompressionBombErrorNrr#r$r%r(r(Or&r$r(ÚboolÚWARN_POSSIBLE_FORMATSiUUUú
int | NoneÚMAX_IMAGE_PIXELS)Ú_imagingÚPILLOW_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 y) Ú Transposerr éééééN)
r r!r"ÚFLIP_LEFT_RIGHTÚFLIP_TOP_BOTTOMÚ ROTATE_90Ú
ROTATE_180Ú
ROTATE_270Ú TRANSPOSEÚ
TRANSVERSEr#r$r%r0r0s%Ø€OØ€OØ€IØ€JØ€JØ€IØJr$r0có eZdZdZdZdZdZdZy)Ú Transformrr r1r2r3N)r r!r"ÚAFFINEÚEXTENTÚ PERSPECTIVEÚQUADÚMESHr#r$r%r>r>ŠsØ
€FØ
€FØ€KØ €DØ Dr$r>có$eZdZdZdZdZdZdZdZy)Ú
Resamplingrr3r1r4r2r N) r r!r"ÚNEARESTÚBOXÚBILINEARÚHAMMINGÚBICUBICÚLANCZOSr#r$r%rErEs Ø€GØ
€CØ€HØ€GØ€GØGr$rEçà?çð?ç@g@cóeZdZdZdZdZdZy)ÚDitherrr r1r2N)r r!r"ÚNONEÚORDEREDÚ RASTERIZEÚFLOYDSTEINBERGr#r$r%rPrP¦sØ €DØ€GØ€IØNr$rPcóeZdZdZdZy)ÚPaletterr N)r r!r"ÚWEBÚADAPTIVEr#r$r%rVrV®s Ø
€CØHr$rVcóeZdZdZdZdZdZy)ÚQuantizerr r1r2N)r r!r"Ú MEDIANCUTÚ MAXCOVERAGEÚ
FASTOCTREEÚ
LIBIMAGEQUANTr#r$r%rZrZ³sØ€IØ€KØ€JØMr$rZÚDEFAULT_STRATEGY)ÚElement)Ú
PrettyPrinter)Ú ImageFileÚ ImageFilterÚ ImagePaletteÚImageQtÚTiffImagePlugin)Ú CapsuleTypeÚ
NumpyArrayÚStrOrBytesPathú list[str]ÚIDzodict[str, tuple[Callable[[IO[bytes], str | bytes], ImageFile.ImageFile], Callable[[bytes], bool | str] | None]]ÚOPENúdict[str, str]ÚMIMEz:dict[str, Callable[[Image, IO[bytes], str | bytes], None]]ÚSAVEÚSAVE_ALLÚ EXTENSIONz$dict[str, type[ImageFile.PyDecoder]]ÚDECODERSz$dict[str, type[ImageFile.PyEncoder]]ÚENCODERSÚlittleúImagecóÌtj|j«}|j|jf}t |j «}|dk7r||fz
}||jfS©Nr )r ÚgetmodeÚmodeÚheightÚwidthÚlenÚbandsÚtypestr)ÚimÚshapeÚextras r%Ú_conv_type_shaper…ésWÜ×ј"Ÿ'™'Ó"€AØ Ÿi™i¨¯©Ð2€EÜ ‹L€EØ ‚zØ
%ÑˆØ !—)‘)Ð Ðr$)ÚCMYKÚHSVÚI;16úI;16BúI;16LzI;16NÚLAÚLaÚLABÚPAÚRGBÚRGBAÚRGBaÚRGBXÚYCbCr)rr—r•r‡rrcó@tj|«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 rzÚbasemode©r{s r%Ú getmodebaserœsô × Ñ ˜ "× +r$có@tj|«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 rzÚbasetypers r%Ú getmodetyperŸsô × Ñ ˜ "× +r$có@tj|«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 rzrrs r%Úgetmodebandnamesr¡'sô × Ñ ˜ "× (r$cóRttj|«j«S)
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.
)r~r rzrrs r%Ú getmodebandsr£6s ô Œy× Ñ  Ó&× -r$z.bmpÚBmpImagePluginz.dibz.gifÚGifImagePluginz.jfifÚJpegImagePluginz.jpez.jpgz.jpegz.pbmÚPpmImagePluginz.pgmz.pnmz.ppmz.pfmz.pngÚPngImagePluginz.apngz.avifÚAvifImagePluginz.avifsz.blpÚBlpImagePluginz.bufrÚBufrStubImagePluginz.curÚCurImagePluginz.dcxÚDcxImagePluginz.ddsÚDdsImagePluginz.psÚEpsImagePluginz.epsz.fitÚFitsImagePluginz.fitsz.fliÚFliImagePluginz.flcz.fpxÚFpxImagePluginz.ftcÚFtexImagePluginz.ftuz.gbrÚGbrImagePluginz.gribÚGribStubImagePluginz.h5ÚHdf5StubImagePluginz.hdfz.icnsÚIcnsImagePluginz.icoÚIcoImagePluginz.imÚ
ImImagePluginz.iimÚIptcImagePluginz.jp2ÚJpeg2KImagePluginz.j2kz.jpcz.jpfz.jpxz.j2cz.micÚMicImagePluginz.mpgÚMpegImagePluginz.mpegz.mpoÚMpoImagePluginz.mspÚMspImagePluginz.palmÚPalmImagePluginz.pcdÚPcdImagePluginz.pcxÚPcxImagePluginz.pdfÚPdfImagePluginz.pxrÚPixarImagePluginz.psdÚPsdImagePluginz.qoiÚQoiImagePluginz.bwÚSgiImagePluginz.rgbz.rgbaz.sgiz.rasÚSunImagePluginz.tgaÚTgaImagePluginz.icbz.vdaz.vstz.tifrfz.tiffz.webpÚWebPImagePluginÚWmfImagePluginÚXbmImagePluginÚXpmImagePlugin)z.wmfz.emfz.xbmz.xpmÚ_EXTENSION_PLUGINcó–|syt|t«r|j«}|j«}|tvryt
j
|«}|y tjd|«ttjd|t«t«g«y#t$r!}tjd||«Yd}~yd}~wwxYw)z<Import only the plugin needed for a specific file extension.FTNú Importing %súImage: failed to import %s: %s)Ú
isinstanceÚbytesÚdecodeÚlowerrqÚgetÚloggerÚdebugÚ
__import__Ú__spec__ÚparentÚglobalsÚlocalsÚ ImportError)ÚextÚpluginÚes r%Ú_import_plugin_for_extensionrãá Øä#”uÔØj‰j‹lˆØ
)‰)+€CØ
ŒiÑØä
×
" 
'€FØ
€~ØðÜ ^ VÔ”h—o&  0´'³)¼V»XÀrÔøÜ òÜ Ð5°v¸qÔûðúsÁAB CÂ'CÃCcó.tdk\ry ddlm}|sJ ddlm}|sJ ddlm}|sJ ddlm}|sJ ddlm}|sJ day#t$rYŒ>wxYw#t$rYŒAwxYw#t$rYŒDwxYw#t$rYŒGwxYw#t$rYdaywxYw)z|
Explicitly loads BMP, GIF, JPEG, PPM and PNG file format drivers.
It is called when opening or saving images.
r N))))))Ú _initializedÚ)s r%Úpreinitrç­ôØð
ÝЉ~ð
ÝЉ~ð
ÝÐð
ÝЉ~ð
ÝЉ~ðLøô7 ò
Ù ð
ûô ò
Ù ð
ûô ò
Ù ð
ûô ò
Ù ð
ûô ò
Ø à
úsUŒ
A
˜
A¤
A(°
A7¼
BÁ
AÁAÁ A%Á$A%Á( A4Á3A4Á7 BÂBÂ BÂBcó6tdk\rytD]J} tjd|«t t
j d|t«t«g«ŒLtstrdayy#t$r!}tjd||«Yd}~Œ‚d}~wwxYw)
Explicitly initializes the Python Imaging Library. This function
loads all available file format drivers.
It is called when opening or saving images if :py:meth:`~preinit()` is
insufficient, and by :py:meth:`~PIL.features.pilinfo`.
r1FrÐNT) rrlro)s r%ÚinitréÚsôØäòFˆð FÜ L‰L˜¨Ô œ(Ÿ/™/Ð*¨!¨F¨8Ð4´g³iÄÃÈ2Õ Fõ ˆ ØØ øô
ò FÜ L‰LÐ9¸6À1× Eûð Fús•AA.Á. BÁ7BÂBcó|d}nt|t«s|f} t|}||g||z¢­ŽS#t$rYnwxYw t t
|d«}n##t $r}d|d}t|«|d}~wwxYw||g||z¢­ŽS)Nr#Ú_decoderzdecoder ú not available)ÚtuplerrÚKeyErrorÚgetattrÚcoreÚAttributeErrorÚOSError)r{Ú decoder_nameÚargsr„ÚdecoderrâÚmsgs r%Ú _getdecoderr÷øó°ð €|ØÜ
˜œeÔ
ˆð˜<Ññ+˜d U™lÒ+øô ò
Ù ð
úð
œ$ < Ð 9Ó:‰øÜ ò˜˜ nÐ5ˆÜc‹l Ð!ûð"úñ  '˜$ ™,Ò 'ó#š /¯ ;º;¿AÁ A3ÁA.Á.A3có|d}nt|t«s|f} t|}||g||z¢­ŽS#t$rYnwxYw t t
|d«}n##t $r}d|d}t|«|d}~wwxYw||g||z¢­ŽS)Nr#Ú_encoderzencoder rì)rs)r{Ú encoder_namerôr„Úencoderrâs r%Ú _getencoderrþcóPeZdZdZd
dZd dZd dZeZd dZd dZ d dZ
e
Z d dZ y )
ÚImagePointTransformzÙ
Used with :py:meth:`~PIL.Image.Image.point` for single band images with more than
8 bits, this represents an affine transformation, where the value is multiplied by
``scale`` and ``offset`` is added.
có ||_||_y©N)ÚscaleÚoffset)Úselfrrs r%Ú__init__zImagePointTransform.__init__5s؈Œ
؈ r$cóFt|j |j «Sr)rrr©rs r%Ú__neg__zImagePointTransform.__neg__9sÜ" D§J¡J ·±° Ó=r$cóÜt|t«r:t|j|jz|j|jz«St|j|j|z«Sr)rrr©rÚothers r%Ú__add__zImagePointTransform.__add__<sUÜ  
˜UŸ[™[Ñ(¨$¯+©+¸¿ ¹ Ñ*Dóð
ô# 4§:¡:¨t¯{©{¸UÑ/BÓCr$có|| zSrr#r s r%Ú__sub__zImagePointTransform.__sub__EsØuf‰}Ðr$có|| zSrr#r s r%Ú__rsub__zImagePointTransform.__rsub__Hsؘu‰}Ðr$cózt|t«rtSt|j|z|j|z«Sr©rÚNotImplementedrrr s r%Ú__mul__zImagePointTransform.__mul__Kó2Ü   " 4§:¡:°Ñ#5°t·{±{ÀUÑ7JÓKr$cózt|t«rtSt|j|z |j|z «Srrr s r%Ú __truediv__zImagePointTransform.__truediv__Rrr$N)rÚfloatrrÚreturnÚNone)rr)r zImagePointTransform | floatrr)
r r!r"Ú__doc__rr r
Ú__radd__rrrÚ__rmul__rr#r$r%rr.s;ñó óDð€HóóóLð
€HôLr$rcó~|tdd««}t|t«r|j|jfSd|fS©Nr r)rrr)ÚexprÚas r%Ú_getscaleoffsetr#Xs<ñ
Ô
  
'€AÜ",¨QÔ0CÔ"DˆAG‰GQ—X ÐPÈ1ÈaÈ&ÐPr$cóeZdZ ddZy)ÚSupportsGetDatacóyrr#rs r%ÚgetdatazSupportsGetData.getdatadsà*-r$N)rztuple[Transform, Sequence[int]])r r!r"r'r#r$r%r%r%csð.à (ô.r$r%cóÞeZdZUdZdZded<dZded<dZd`dZe dad«Z
e
jdbd „«Z
e dcd
«Z e dcd «Z
e ddd «Ze ded
«Ze dcd«Zejdfd«ZdgdZdhdZdidZd`dZd`dZd`dZ dj dkdZdldZdedZdmdZdndZdodZdodZe dpd«ZdqdZ dr dsdZ dtd „Z!dud!„Z"dvdwd"„Z#dxdyd#„Z$ dv dzd$„Z%d{d%„Z&d`d&„Z'ddde(jRd'f d|d(„Z*d'dd)de+jXf d}d*„Z-dhd+„Z.e.Z/drd~d,„Z0 dd-„Z1 d€d.„Z2dd/„Z3dd0„Z4dd1œdƒd2„Z5 d„ d…d3„Z6drd†d4„Z7 dr d‡d5„Z8dˆd6„Z9d‰d7„Z:dŠd8„Z;d`d9„Z<dd:„Z=dŒd;„Z>ddŽd<„Z?e dd=„«Z@d`d>„ZA dd?„ZBdd@„ZC dj ddA„ZD dj d“dB„ZE dj d”dC„ZF d• ddD„ZG dr d—dE„ZHd˜dF„ZI d™ dšdG„ZJ d ddH„ZK dœdI„ZL dr ddJ„ZM dždK„ZN d dL„ZO dr d¡dM„ZPeQj¤dNdddf d¢dO„ZS dr d£dP„ZTd¤dQ„ZUd¥dR„ZVdrd¦dS„ZWd§dT„ZXd¨dU„ZYdcdV„ZZeQj¶dWf d©dX„Z\deQj¤dYdf dªdZ„Z]eQj¤df d«d[„Z^d¬d\„Z_d­d]„Z`d®d^„Zad¯d_„Zby)°rwaD
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`
str | NoneÚformatÚformat_descriptionTcófd|_d|_d|_d|_i|_d|_d|_y)Nræ©rrr)Ú_imÚ_modeÚ_sizeÚpaletteÚinfoÚreadonlyÚ_exifrs r%rzImage.__init__ys3à<@ˆŒØˆŒ
؈Œ
Ø9=ˆŒ Ø68ˆŒ ؈Œ
Ø"&ˆ
r$có–t|jt«r|jj|jJ|jSr)r.rÚexrs r%rzImage.imƒs7ä d—h
Ô —(‘(—+‘+Ð Øx‰xÐx‰xˆr$có||_yr)r.©rrs r%rzImage.imŠs àˆr$có |jdS©Nr©Úsizers r%r}z Image.widthŽóày‰y˜‰|Ðr$có |jdSryr;rs r%r|z Image.heightr=r$có|jSr)r0rs r%r<z
Image.sizeó àz‰zÐr$có|jSr)r/rs r%r{z
Image.modešr@r$cóf|jxr|jjxs |jSr)r.r3Ú _readonlyrs r%r3zImage.readonlyžs$àÒ.˜TŸX™X×A°4·>±>ÐAr$có||_yr)rC)rr3s r%r3zImage.readonly¢s à!ˆr$cóVt«}||_|j|_|j|_|jdvrH|j r |j j«|_nddlm }|j«|_|jj«|_
|S)rr“r ©rd) rwrr{r/r<r0r1Úcopyrærdr2)rrÚnewrds r%Ú_newz
Image._new¦syÜ‹gˆØˆŒØ—G‘GˆŒ Ø—G‘GˆŒ Ø
7‰7 |Š|Ø"Ÿl™l×1 å7˜l×9 Ø—99—>#ˆŒØˆ
r$có|Srr#rs r%Ú __enter__zImage.__enter__¶s؈ r$cóyrr#)rs r%Ú__exit__zImage.__exit__¹sØ r$cóØt|dd«rDtjdk(r*ttd«r|jj «d|_t
td««|_y)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.
ÚmapNÚwin32Úpypy_version_infozOperation on closed image) rïÚsysÚplatformÚhasattrrPÚcloserÚ
ValueErrorr.rs r%rVz Image.close¼sOô 4˜ Ô |‰|˜&¬7´3Ð8KÔ+LØÔ Ø)-ˆDŒHô
Ð,GÓ!HÓIˆr$cóp|j«|jj«|_d|_yr:)ÚloadrrHr3rs r%Ú_copyz Image._copyÐs#Ø ‰ Œ Ø—''—,,“.ˆŒØˆ
r$có^|jr|j«y|j«yr)r3rZrYrs r%Ú_ensure_mutablezImage._ensure_mutableÕsØ =Š=Ø J‰J I‰IKr$c ó8d}|rd|}|s.tj|«\}}tj|«n|}|j |«s||z}|j «|r|dk(r|j j|«|S|j||fi|¤Ž|S)NræÚPPM) ÚtempfileÚmkstempÚosrVÚendswithrYrÚsave_ppmÚsave)rÚfiler*ÚoptionsÚsuffixÚfilenames r%Ú_dumpz Image._dumpÛsðˆÙ ؘ˜\ˆFáÜ"×*¨6Ó2‰KˆAˆ H‰HQˆ×$ # fÑ,à ‰ Œ ᘠ5šØ G‰G× Ñ ˜XÔ ˆð
ˆDI‰Ih Ñ 2¨'Ò ˆr$có‚|j|juryt|t«sJ|j|jk(xrz|j|jk(xr_|j
|j
k(xrD|j
«|j
«k(xr!|j«|j«k(S©NF)Ú __class__rÓrwr{r<r2Ú
getpaletteÚtobytesr s r%Ú__eq__z Image.__eq__óØ >‰> §¡Ñ Ü˜Ô I‰I˜ŸÑ 
 ˜UŸZ™ZÑ
 ˜UŸZ™ZÑ
Ó! U×%5Ñ%5Ó%7Ñ
  %§-¡-£/Ñ 
r$cóØd|jjd|jjd|jd|jdd|jddt |«d d
S) Nruú image mode=ú size=rÚxr z at 0xÚXrv)rmr!r r{r<Úidrs r%Ú__repr__zImage.__repr__ÿsmà×*¨!¨D¯N©N×,CÑ,CÐ+DðEØŸ)™)˜ F¨4¯9©9°Q©<¨.¸¸$¿)¹)ÀA¹,¸ðHÜt“H˜Q<˜

r$c
óÞ|jd|jjd|jjd|jd|j
dd|j
dd «y )
z"IPython plain text display supportrurrrsrrtr rvN)Útextrmr!r r{r<)rÚcycles r%Ú
_repr_pretty_zImage._repr_pretty_sfð
Ø×*¨!¨D¯N©N×,CÑ,CÐ+DðEØŸ)™)˜ F¨4¯9©9°Q©<¨.¸¸$¿)¹)ÀA¹,¸Àqð
Jõ
r$c ó’tj«} |j||fi|¤Ž|j «S#t$rYywxYw)zHelper function for iPython display hook.
:param image_format: Image format.
:returns: image as bytes, saved into the given format.
N)ÚioÚBytesIOrdÚ ExceptionÚgetvalue)rÚ image_formatÚkwargsÚbs r%Ú _repr_imagezImage._repr_imagesKô
J‰Jð Ø ˆDI‰IÑ Ò z‰z‹|Ðøôò Ùð ús:º AÁAcó(|jdd¬«S)zjiPython display hook support for PNG format.
:returns: PNG version of the image as bytes
ÚPNGr )Úcompress_level©r…rs r%Ú
_repr_png_zImage._repr_png_sð
×Ñ °aÐÓ8r$có$|jd«S)zliPython display hook support for JPEG format.
:returns: JPEG version of the image as bytes
ÚJPEGr‰rs r%Ú _repr_jpeg_zImage._repr_jpeg_$sð
×Ñ Ó'r$có¦ddi}|jdk(r|jdd«|d<n|j«|d<t|«\|d<|d<|S) NÚversionr2r†ÚrawrŽÚdatarƒr€)r{ror…)rrIs r%Ú__array_interface__zImage.__array_interface__+s\ð@IÈ!¸nˆØ 9‰9˜Ò ðŸ,™, u¨cÓ2ˆCŠKàŸ,™,.ˆC‰KÜ'7¸Ó'=Ñ$ˆˆG‰ c˜)ˆ
r$cóV|j«|jj«Sr)rYrÚ__arrow_c_schema__rs r%r”zImage.__arrow_c_schema__8sØ ‰ Œ Øw‰w×+r$cóŠ|j«|jj«|jj«fSr)rYrr”Ú__arrow_c_array__©rÚrequested_schemas r%rzImage.__arrow_c_array__<s2ð
‰ Œ Ø×,¨d¯g©g×.GÑ.GÓ.IÐJr$cóˆ|j«}|j|j|j|j «|gSr)ror2r{r<rn)rÚim_datas r%Ú __getstate__zImage.__getstate__Bs1Ø—,,“.ˆØ— ‘ ˜4Ÿ9™9 d§i¡i°·±Ó1BÀGÐLr$cóôtj|«|dd\}}}}}||_||_||_t j ||«|_|dvr|r|j|«|j|«y)Nr4©rrr“)
rwrr2r/r0rIrÚ
putpaletteÚ frombytes)rÚstater2r{r<r1rs r%Ú __setstate__zImage.__setstate__FsnÜ
Ø*/°°¨)Ñ'ˆˆdD˜' ˆŒ ؈Œ
؈Œ
Ü—(‘(˜4 ÓŒØ Ð )©gØ O‰O˜GÔ  r$có\|}t|«dk(rt|dt«r|d}|dk(r|dk(r |j}|j «|j
dk(s|j dk(ryt|j||«}|j|jd|jz«ddl m }t|j|jddz«}g} |j|«\}} }
|j!|
«| rnŒ*| dkrd | d
} t#| «dj%|«S) 
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$r-©rbr3zencoder error z in tobytes)r~r{rYr}r|Úsetimagerr<rbÚmaxÚMAXBLOCKÚencodeÚappendÚ RuntimeErrorÚjoin) rÚ encoder_argsrârbÚbufsizeÚoutputÚbytes_consumedÚerrcoders r%roz
Image.tobytesQsð0!ˆ Ü ˆ|Ó  Ò !¤j°¸Ä%Ô&Hà™?ˆ ˜  \°RÒ%7ØŸ9™9ˆLà ‰ Œ à :‰:˜Š?˜dŸk™k¨QÒô
˜Ÿ ™  Ó >ˆØ
4—7‘7˜F T§Y¡YÑä(¨$¯)©)°A©,¸Ñ*:ÓàˆØØ,-¯H©H°WÓ,=Ñ )ˆN˜G TØ M‰M˜$Ô ÙØð ð
QŠ;Ø" 7 )¨;Ð7ˆ˜ x‰x˜ÓÐr$cóZ|j«|jdk7r
d}t|«|jd«}dj d|d|j
ddj
d «d|d
|j
d dj
d «d |d
j
d «|dg«S)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"
r†z not a bitmapÚxbmr$z#define z_width rú
Úasciiz_height r z static char z _bits[] = {
s};)rYr{rWror<)rÚnamerörs r%ÚtobitmapzImage.tobitmapŠð
‰ Œ Ø 9‰9˜Ò Ø ˆCܘS“/Ð |‰|˜"ˆØx‰xà˜4˜¨¯ © °!©  ~°RÐÓ˜4˜& ¨¯©°1©¨°bÐÓ˜t˜f NÐ:¸7ÓØð 
ó
ð
r$có´|jdk(s|jdk(ry|}t|«dk(rt|dt«r|d}|dk(r|dk(r |j
}t
|j
||«}|j|jd|jz«|j|«}|ddk\r
d}t|«|ddk7r
d}t|«y) 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 rr#r-znot enough image datazcannot decode image data) r}r|r~r{rr<rW)rrÚ decoder_argsÚsrös r%zImage.frombytes¤ð :‰:˜Š?˜dŸk™k¨QÒ à ˆ Ü ˆ|Ó  Ò !¤j°¸Ä%Ô&Hà™?ˆ ˜  \°RÒ%7ØŸ9™9ˆLô
˜Ÿ ™  Ó >ˆØ
4—77˜F T§Y¡YÑ
H‰HTà ˆQ‰41Š9Ø)ˆCܘS“/Ð ˆQ‰41Š9Ø,ˆ˜S“/Ð  r$có¦|j“|jr†|jjro|jj«\}}|jj |jj ||«d|j_d|j_d|jvr…|dvrt|jdt«r*|jj|jdd«n(|jj|jd«d|j_nl|jj |k7rS|jj|jj |jj «|j_|j%|jj|j«Sy)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Ú transparency©rr“r•)r.r1Údirtyr'rr{Úrawmoder2ÚintÚputpalettealphaÚputpalettealphasrnÚ pixel_accessr3)rr{Úarrs r%rYz
Image.loadÉsHð 8‰8Ñ  D§L£L°T·\±\×5GÓ5GàŸ ×.‰IˆD G‰G× Ñ ˜tŸ|™|×0°$¸Ô <Ø!"ˆDL‰LÔ Ø#'ˆDL‰LÔ Ø §¡Ñ*¨t°|Ñ/CܘdŸi™i¨ÑÔ—G‘G×+¨D¯I©I°nÑ,EÀqÕ—GG×,¨T¯Y©Y°~Ñ-FÔGØ$* Õ×" (,§w¡w×'9Ñ'9Ø—LL×% t§|¡|×'8Ñ'8ó( Ô 8‰8Ð Ø—77ׯ
©
Ó r$cóy)as
Verifies the contents of a file. For data read from a file, this
method attempts to determine if the file is broken, without
actually decoding the image data. If this method finds any
problems, it raises suitable exceptions. If you need to load
the image after using this method, you must reopen the image
file.
Nr#rs r%Úverifyz Image.verifyïsð
r$écól|j«d|jv}|s=|jdk(r.|jr|jj}nd}|dk(r|rd}|r||jk(rs|j «SrÈ|dvr
d}t |«|j j|«}|j|«} |r†|j jdk(rm| jdŠ d$dŠ|d k(r
«Šn6t|«dk(r(tˆˆˆfd
tt««D««Š| jd<| S|jdk(r^|dk(r|j|«S|d k(rC|j«\}
} } }
td|
| | f«}|j|«}td ||
f«Sd }d
}|r2|jdvr|dvs|jdk(rK|dvrG|j|j j!||jd««} | jd=| S|jdvr-|dvr(|jd}t#|t$«rt'j(d«d}nzt+|jd«}|jdk(r{|jJ|j-|j|jj«t#|t«r-d}|jJ |jj/||«}|d }nÕ|j3d|«|dvr|j5|«}n|j5d«}|j7d«}nŠ|jdk(r{|dvrw|jd}d}t#|t$«r|j j9|«n:t#|t:«r|j j=|d«n
d}t |«|dk(rÌ|t>j@k(r¹|j j|«}|j|«} ddl!m"}|jDd| j jGd««| _|r
| jd=|C | jj/tItt:df|«| «| jd<| S| Sd|j|fvr­|}|dk(r,|jd vr|j5d«}|j}n|}|d vrtdd!l!m&}|jOd"«}|jOd«}|jdk(r||gn||g}|jQ|d|d|j|«}|jS|«S|tTjV} |j j5||«}|j|«} |d#vr@|t>j@k7r-ddl!m"}|jDd|jGd««| _|r
| jd=|m| jdk(rO| jrC | jj/tItt:df|«| «| jd<| S|| jd<| S#t
$r(}t1|«dk(rd }n t |«|Yd }~Œ˜d }~wwxYw#tJ$r&| jd=t'j(d«Y| SwxYw#t
$rw tY|j«}||jk(r|j j5|«}|j5||«}n#tZ$r}d}t |«|d }~wwxYwYŒºwxYw#t
$r;}| jd=t1|«dk7rt'j(d«Yd }~| Sd }~wwxYw)%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.
rr”r•)r”zillegal conversionr2c ó˜|d|dz|d|dzz|d|dzz|ddzz}tdtdt|«««S)Nrr r1r2rLéÿ)Úminr¿)rÚvalues r%Úconvert_transparencyz+Image.convert.<locals>.convert_transparencyFs\ð˜a™D 1 Q¡4™K¨!¨A©$°°1±©+Ѹ!¹¸qÀ¹t¹ ÑCÀaÈÁdÈSÁjÑP˜q¤# c¬3¨u«:Ó"6Ó7r$c3óHK|]}|dz|dzdz«Œy­w)r3Nr#)Ú.0ÚirÍÚmatrixr»s €€€r%ú <genexpr>z Image.convert.<locals>.<genexpr>Os3øèø€ò)àñ-¨V°A¸±E¸AÀ¹EÀA¹IÐ-FÈ ×)ùsƒ"r“NF)r†r©rr•)rrrr•)r”rzVPalette images with Transparency expressed in bytes should be converted to RGBA imagesT©r r z2Couldn't allocate a palette color for transparencyz$cannot allocate more than 256 colorsr-©rr“r•rz.Transparency for P mode should be bytes or intr rG.z0Couldn't allocate palette entry for transparencyr)r”r•r—)ÚImageCmsÚsRGBrF)rztuple[float, ...]rËztuple[int, int, int]rr¿).rYr2r{r1rHrWrÚconvert_matrixrJrr~ÚrangeÚquantizeÚsplitÚmergeÚconvert_transparentrÓÚwarningsÚwarnrIÚgetcolorÚstrÚputpixelÚconvertÚgetpixelrÁr¿rVrXrdrnrr€Ú
createProfileÚbuildTransformÚapplyrPrT) rr{Úditherr1ÚcolorsÚhas_transparencyrörÚnew_imÚgr„r"ÚrgbrzÚtrnsÚ delete_trnsÚtrns_imÚerrrârdÚ
other_moderÖÚsrgbÚlabÚprofilesÚ transformÚmodebaserÍs ` @@r%z
Image.convertúsEú€ðh
‰ Œ à)¨T¯Y©YÐÙ˜Ÿ ™  SÒ|Š|Ø—|‘|×(‘àØuŠ}Ñ!1ØÙ˜ § ¡ Ò)±&Ø—99“;Ð á à˜*Ü  “oÐרfÓ5ˆ—YY˜r“]ˆFÙ D§G¡G§M¡M°QÒ$6Ø%Ÿ{™{¨>Ñ: ð8Ø-Aðó ˜3’;Ù#7¸À Ó#M‘Lܘ“Y !^Ü#(õ)ä!&¤s¨<Ó'8Ó!9ô)ó$/; ˜NшMà 9‰9˜Ò ØsŠ{Ø—}‘} VÓ˜Ø!ŸZ™Z›\‘
1a˜Ü˜E A q¨! -Ø—LL Ó(ܘT A q 6ӈ؈ â Ø— ‘ ÐÀÑ9OØ ˜" tÐ/KÑ'KðŸØ—G‘G×°d·i±iÀÑ6OÓð—K‘K Ð
ØÐ/°DÐ<MÒ4MØ—II˜-ܘa¤Ô—Mð#'" $§)¡)¨VÓ4—yy #Ÿ|™|Ð×*¨4¯<©<¸¿¹×9JÑ9JÔ% Ô/Ø"V˜CØ#*§?¡?Ð#>Ð>Ð#>ðAØ$+§O¡O×$<Ñ$<¸Ó$E ð#™à×°Ô /Ø&-§o¡o°dÓ&;™Gð'.§o¡o°eÓ&<˜&×Ó7™à˜! dÐ.BÑ&BØ—II˜-Ø" ä˜Ô—G‘G×,¨QÕ ¤3Ô—GG×+¨A¨qÕJ$ S 3Š;˜7¤g×&6Ñ&6Ò×! )ˆ—YY˜r“]ˆ 6˜\×v—y+¨EÓˆFŒNñð—K‘K ÐÐð VØ28·.±.×2IÑ2IÜœU¤3¨ 8™_¨dÓó3F—K‘K ÑˆM6ˆMà T—Y‘Y Ð ˆBØuŠ}Ø—7‘7Ð"9ÑŸ +ŸW™W‘
à!
ØÐ×-¨fÓ5Ø×,¨UÓ3Ø*,¯'©'°UÒ*:˜C ™;ÀÀsÀ ؘQ‘K ¨!¡¨b¯g©g°tó ð!— rÓ ˆ×*ˆFð   vÓ.ˆBð˜2“ˆØ   7¬g×.>Ñ.>Ò#>Ý 6˜\×6°u¸b¿m¹mÈEÓ>RÓSˆFŒNÙ à ˜NÐ Ð Ø{‰{˜cÒ! f§n¢nð Ø28·.±.×2IÑ2IÜœU¤3¨ 8™_¨dÓ3°Vó3F—Kш
ð/3 ˜Nш
øôm$.òAÜ#& q£6Ð-SÒ#Sð)-¡Aä*4°S«/¸qÐ$@õ%&ûð AûôdV🠠—M‘MÐ"TÕˆ Vûô@ò

& t§y¡yÓ1ؘtŸy™yÒØ—W‘W—_‘_ XÓ.Ø—Z‘Z  fÓ-‘øÜò
*Ü  “o¨1Ð,ûð
-úòð
-ûô4ØŸ  ˜1“vÐ!GÒ
Øûð
ˆ
ûðús{Ë>ZÒAZ:Ö[,Ø3A]/Ú Z7ÚZ2Ú2Z7Ú:+[)Û([)Û, ],Û6A] Ý],Ý ]%Ý] Ý ]%Ý%],Ý+],Ý/ ^3Ý80^.Þ.^3rcó¦|j«|€/tj}|jdk(rtj}|jdk(r/|tjtj
fvr
d}t
|«|r®|j«|jdk7r
d}t
|«|jdvr
d}t
|«|jjd||j«}|j|«}|jJ|jj«|_
|S|dkr
d }t
|«|j|jj|||««}d
d l
m} |jj«}
|jj!|
|
«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
Nr•zoFast Octree (method == 2) and libimagequant (method == 3) are the only valid methods for quantizing RGBA imagesrzbad mode for palette image>r”z7only RGB or L mode images can be quantized to a paletterzkmeans must not be negativer rG)rYrZr[r{r]r^rWrrJr1rHrdÚgetpalettemodernr~) rÚmethodÚkmeansr1rrdr{Ú palette_datas r%zImage.quantizeúsðF
‰ Œ à ˆ×'ˆy‰y˜!×,à 9‰9˜Ò  6Ü × Ñ Ü × 2
ñ$
ð Hð
ô˜S“/Ð à L‰LŒNØ|‰|˜2Ü  “oÐy‰y  ÑOÜ  “oР f¨g¯j©jÓ9ˆBØ—Y‘Y˜r“]ˆFØ—?‘?Ð $Ÿ_™_×3ˆFŒN؈Mà AŠ:Ø/ˆCܘS“/Ð
Y‰Yt—ww×°¸Ó
@ˆåu‰u×%ˆØ—uuרdÓ3Ð4H°f¼sÀ4»yÑ6HÐIˆ Ø.\×.¨t°\ÓŒ
àˆ r$cót|j«|j|jj««S)
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.
)rYrJrrHrs r%rHz
Image.copyMs&ð
‰ Œ Øy‰y˜ŸŸÓ(r$cóü||j«S|d|dkr
d}t|«|d|dkr
d}t|«|j«|j|j |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.
r1rz&Coordinate 'right' is less than 'left'r2r z'Coordinate 'lower' is less than 'upper')rHrWrYrJÚ_cropr)rÚboxrös r%Úcropz
Image.cropZsxð ˆ—9‘9“;Ð à ˆq‰6‘FŠ?Ø:ˆCܘS“/Ð
‰Vc˜!‘fŠ_Ø;ˆCܘS“/Ð  ‰ Œ Øy‰y˜Ÿ D§G¡G¨SÓ2r$cóÀtttt|««\}}}}t||z
«t||z
«f}t |«|j ||||f«S)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.
)rPr¿ÚroundÚabsÚ_decompression_bomb_checkr)rrrÚx0Úy0Úx1Úy1Úabsolute_valuess r%rz Image._croptsXôœS¤#¤e¨S£/Ó2‰ˆˆB˜r B™w¨R°"©W«Ð6ˆä! w‰w˜˜B  (r$cóy)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{r<s r%Údraftz Image.draftŠsð.
r$c
ó6ddlm}|j«t|«r|«}t |d«s
d}t |«t
||j«}|jjdk(s|r*|j|j|j««St|jj«Dcgc];}|j|j|jj|«««Œ=}}t|j|«Scc}w)
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 )rcÚfilterz>filter argument should be ImageFilter.Filter instance or class)rcrYÚcallablerUÚ TypeErrorrÓÚMultibandFilterrrrJrÚgetbandrÜr{)rrrcÚ multibandÚimss r%rz Image.filter£õ ‰ Œ ä  Ù“XˆFÜv˜xÔRˆCܘC“.Ð ä˜v {×'BÑ'BÓCˆ Ø 7‰7=‰=˜ ¡Ø—9‘9˜VŸ]™]¨4¯7©7Ó CHÈÏÉÏ
É
ÓBVö
Ø=>ˆDI‰If—mm D§G¡G§O¡O°AÓ$6Ó 
ˆð
ôT—Y‘Y Ó$ùò
sÂ>ADcóTtj|j«jS)
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 rzr{rrs r%ÚgetbandszImage.getbands¾sô× Ñ  §¡Ó1r$)Ú
alpha_onlycóX|j«|jj|«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.
)rYrÚgetbbox)rrs r%rz
Image.getbboxÈs ð
‰ Œ Øw‰w˜*r$có|j«|jdvrN|jj«}t d«Dcgc]}||sŒ |||fŒ}}t |«|kDry|S|jj
|«Scc}w)
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.
)r†rN)rYr{rÚ histogramrÙr~Ú getcolors)rÚ maxcolorsÚhrÐÚouts r%rzImage.getcolorsÛsð
‰ Œ Ø 9‰9˜Ñ ×#ˆAÜ?DÀS»zÖ+R¸!ÈQÈqËT¨Q¨q©T°1ªIÐ+RˆCÐ+RÜ3x˜ØˆJØw‰w× Ñ  Ó+ùò ,Ss Á
BÁ BcóŽtddd«|j«||jj|«S|jS)
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.getdataéÚget_flattened_data)rrYrr©rÚbands r%r'z
Image.getdataôs=ô" ÐÐ-AÔ ‰ Œ Ø Ð Ø—7‘7—?‘? 4Ó w‰wˆr$có˜|j«|$t|jj|««St|j«S)
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.
)rYrrr&s r%r%zImage.get_flattened_data s9ð
‰ Œ Ø Ð Ü˜ŸŸ¨Ó T—W‘Wr$cóìj«jjdkDr1tˆfdt jj«D««Sjj «S)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 c3ópK|]-}jj|«j«Œ/y­wr)rrÚ
getextrema)rs €r%z#Image.getextrema.<locals>.<genexpr>*s'øèø€ÒW¸Q˜ŸŸ¨ÓWùsƒ36)rYrrr+rs`r%r+zImage.getextremasOø€ð
‰ Œ Ø 7‰7=‰=˜1Ò ÜÓWÄ%ÈÏÉÏ
É
ÓBVÔ w‰w×#r$có ddŠdˆˆfd Šttjd«iSd|jvriStj|jdj d««}|j «|«iS)z™
Returns a dictionary containing the XMP tags.
Requires defusedxml to be installed.
:returns: XMP tags in a dictionary.
có0tjdd|«S)Nz^{[^}]+}ræ)ÚreÚsub)Útags r%Úget_namezImage.getxmp.<locals>.get_name5sÜ—66˜* b¨#Ó .r$có |jj«Dcic]\}}|«|Œ}}}t|«}|r]|D]V}|j«}‰ |«}||vr1t ||t«s ||g||<||j |«ŒR|||<ŒX|S|r|j r|j |d<|S|j Scc}}w)Nry)ÚattribÚitemsÚlistr0ry)
ÚelementÚkrËÚchildrenÚchildr´Ú child_valuer1Ú get_values
€€r%r;zImage.getxmp.<locals>.get_value8ø€Ø@GÇÁ×@TÑ@TÓ@V×$W¹¸¸1¡X¨a£[°!¡^Ð$WˆEÑ$WܘG“}ˆØ2# E§I¡IÓ.DÙ"+¨EÓ"2˜u)¨%°©+´<Ø+0°©;¨-˜E $™Kؘd™ ×*¨;Õ7à&1˜˜ ðˆ Ø—<<Ø$+§L¡LE˜&ˆ—|#ùó!%XsŸC
z5XMP data cannot be read without defusedxml dependencyÚxmps )r0r)r6r`rzstr | dict[str, Any] | None)rr2Ú
fromstringÚrstripr0)rÚrootr1r;s @@r%Úgetxmpz Image.getxmp-stù€ó ô( Ð Ü M‰MÐ ˆIØ ˜Ÿ ™ Ñ ˆIÜ×% d§i¡i°Ñ&6×&=Ñ&=¸hÓ&GÓHˆÙ˜ŸÓ"¡I¨d£OÐ4r$có¬|jt«|_n"|jjr |jSd|j_|jj d«}|d|jvrDt
j
dj|jdjd«dd««}n¼t|d«r°d d
l
m }t||j«sJ|jj|j_|jj"|j_|j&J|jj)|j&|jj*«||jj-|«t.j0j2|jvr|jj d «}d }|s|jj d
«x}rd}|rKt5j6||«}|r3t9|d«|jt.j0j2<|jS)zj
Gets EXIF data from the image.
:returns: an :py:class:`~PIL.Image.Exif` object.
NTÚexifzRaw profile type exifrær2Útag_v2r ©rfzXML:com.adobe.xmpztiff:Orientation(="|>)([0-9])r<stiff:Orientation(="|>)([0-9])r1)r4ÚExifÚ_loadedr2r×ÚfromhexrªrUrfÚ
TiffImageFilerCÚ_bigtiffÚbigtiffÚ_endianÚendianÚfpÚ load_from_fpÚ_offsetrYr
ÚBaseÚ Orientationr.Úsearchr¿)rÚ exif_inforfÚxmp_tagsÚpatternÚmatchs r%Úgetexifz
Image.getexifTð :‰:Р܈D
Z‰Z×
Ò
Ø—: Ø!ˆ
Ôà—II—M‘M )ˆ Ø Ñ Ø&¨$¯)©)Ñ!ŸM™MØ—GG˜DŸI™IÐ&=Ñ>×DÀTÓJÈ1È2Б ô˜˜xÔ! $¨×(EÑ(EÔFØ%)§[¡[×%9Ñ%9
Ô"Ø$(§K¡K×$7Ñ$7
Ô—w‘wÐ
ׯ©°·±×1DÑ1DÔ Ð Ø J‰JO‰O˜  =‰=× $¨D¯J©JÑ —y‘y—}}Ð%8Ó9ˆHØ#Cˆ¨T¯Y©Y¯]©]¸5Ó-AÐ!A Ð!AØ;ÙÜŸ ™  '¨8Ó4ÙÜ<?ÀÀaÁ»MD—JJœxŸ}™}×z‰zÐr$cóŒ|j|jjsyd|j_|j«yrl)r4rFrWrs r%Ú _reload_exifzImage._reload_exifs0Ø :‰:Ð  T§Z¡Z×%7Ò%7Ø Ø"ˆ
ÔØ r$có\ddlm}tdd«|jj|«S)Nr zImage.Image.get_child_imagesé
)rbrÚget_child_images)rrbs r%r\zImage.get_child_images…s'ÝäÐ0°"Ô×"×3°DÓ9r$cóN|j«|jjS)zr
Returns a capsule that points to the internal image memory.
:returns: A capsule object.
)rYrÚptrrs r%Úgetimz Image.getimsð
‰ Œ Øw‰w{‰{Ðr$cóÈ|j« |jj«}||}t |jj ||««S#t$rYywxYw)aG
Returns the image palette as a list.
:param rawmode: The mode in which to return the palette. ``None`` will
return the palette in its current mode.
.. versionadded:: 9.1.0
:returns: A list of color values [r, g, b, ...], or None if the
image has no palette.
N)rYrrWr5rn)rr{s r%rnzImage.getpalette•s`ð
‰ Œ ð Ø—7‘7×+ˆDð ˆ?؈D—GG×& t¨WÓ6øô ò Ùð úsAÁ A!Á A!cóÂ|jdvsd|jvry|jdk(r3|jJ|jjjd«Sy)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.
)rrr“r•rTrÚAF)r{r2r1rbrs r%Úhas_transparency_datazImage.has_transparency_data«sZð
I‰IÐ  §¡ÑØ 9‰9˜Ò Ø—< —<<×$×-¨cÓ r$có†|jdk7sd|jvryddlm}|j d«}|J|jd}t |t «rt|«D]\}}|||dzdz<Œn d ||dzdz<|jdt
|««|_d|j_ |jd=y)
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.
rNr rGr•r3r2r)
r{r2rdrnÚ enumerater1)rrdr1Úalphas r%Úapply_transparencyzImage.apply_transparencyÁð 9‰9˜Ò ˜~°T·Y±YÑ å—// )ˆØÐ—yy Ñ0ˆ Ü l¤EÔ % lÓ
+‘5Ø%*˜˜A™ ™ Ò
-.ˆGL $  0¼¸w»ÓŒ ؈ Ôà I‰I %r$cój|j«|jjt|««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.
)rYr)rÚxys r%zImage.getpixelÙs&ð
‰ Œ Øw‰w×Ѥ b£ Ó*r$cóˆ|j«|jj«\}}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.
)rYrÚ
getprojectionr5)rrtÚys r%rkzImage.getprojectionès6ð
‰ Œ Øw‰w×&‰ˆˆ1ÜA˜Q›ÐÐr$cóD|j«|r6|j«|jjd|j«S|jdvr1|jj||«S|j ««S|jj«S)
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.
r-©rˆ)rYrrr{r+©rÚmaskÚextremas r%rzImage.histogramôsˆð.
‰ Œ Ù Ø I‰IŒKØ—7‘7×$ V¨T¯W©WÓ 9‰9˜
Ñ —77×.óð
Ø48·O±OÓ4Eóð
ðw‰w× Ñ Ó"r$cóD|j«|r6|j«|jjd|j«S|jdvr1|jj||«S|j ««S|jj«S)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
r-rn)rYrÚentropyr{r+ros r%rsz
Image.entropysð$
‰ Œ Ù Ø I‰IŒKØ—7‘7—?‘? 6¨4¯7©7Ó 9‰9˜
Ñ —77—?.óð
Ø48·O±OÓ4Eóð
ðw‰wÓ Ð r$có`t|t«r|
d}t|«|}d}|d}t|«dk(r`t|t«r
|j}n*t|t«r
|j}n
d}t|«||d|dz|d|dzfz
}t|t
«r#ddlm}|j||j«}n€t|t«rn|j«|j|jk7r8|jd k7s|jd
vr|j|j«}|j}n|}|j«|r8|j«|jj|||j«y|jj||«y) 
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 Noner-r1z,cannot determine region size; use 4-item boxrr ©Ú
ImageColorr”)rr•r)rwrWr~r<rvr{rYrr\Úpaste)rrrrpr<rvÚsources r%rwz Image.paste1sfô\ cœ5Ô ÐØUÜ  “oЈD؈Cà ˆ;؈Cä ˆs‹8qŠ=ä˜"œeÔ—w‘w‘ܘD¤%Ô—y‘y‘ðEÜ  “oÐ ‘F˜T !™WÑ$ c¨!¡f¨t°A©wÑ&6Ð 7ˆ bœ#Ô Ý ×¨T¯Y©YÓ7‰FÜ
˜œEÔ
G‰GŒIØy‰y˜BŸG™GÒ—9‘9 Ò¯©Ð8NÑ)NàŸ D§I¡IÓ.—U‘U‰FàˆFà ×ÑÔá Ø I‰IŒKØ G‰GM‰M˜& # t§w¡wÕ G‰GM‰M˜&  &r$cóÌt|ttf«s
d}t|«t|ttf«s
d}t|«t |«dk(r t|«}n4t |«dk(rt|«|j
z}n
d}t|«t |«dk(s
d}t|«t
|«dkr
d}t|«|d |j
zk(r|}n|j|«}t|«|d|jz|d
|jzfz}|d |j
zk(r|}n|j|«}t||«} |j| |«y ) a-'In-place' analog of Image.alpha_composite. Composites an image
onto this image.
:param im: image to composite over this one
:param dest: Optional 2 tuple (left, top) specifying the upper
left corner in this (destination) image.
:param source: Optional 2 (left, top) tuple for the upper left
corner in the overlay source image, or 4 tuple (left, top, right,
bottom) for the bounds of the source rectangle
Performance Note: Not currently implemented in-place in the core layer.
zSource must be a list or tuplez#Destination must be a list or tupler3r1z*Source must be a sequence of length 2 or 4z*Destination must be a sequence of length 2rzSource must be non-negativer-r N) r5rWr~r<rr}r|Úalpha_compositerw)
rrÚdestrxÚoverlay_crop_boxÚoverlayrÚ
backgroundÚresults
r%rzzImage.alpha_compositesKô ˜&¤4¬ 2ˆCܘS“/Ð ˜$¤¤u 
Ô7ˆCܘS“/Ð ˆv‹;˜!Ò Ü$ V›}Ñ Ü
[˜
Ü$ V}¨r¯w©wÑ à>ˆCܘS“/Ð 4y˜AŠ~Ø>ˆCܘS“/Ð ˆv‹;˜Š?Ø/ˆCܘS“/Ð  ˜v¨¯©Ñ ‰Gà—g‘gÐ/ˆGôDk˜T !™W w§}¡}Ñ4°d¸1±gÀÇÁÑ6NÐOˆð &˜4Ÿ9™9Ñ ‰JàŸ 3›ˆJä  ¨WÓØ
6˜r$cóV|j«t|t«r|j|«St |«r~|j
dvr9t
|«\}}|j|jj||««Std«Dcgc]
}||«Œ c}|jjz}n|}|j
dk(r
d}t|«|dk7r|Dcgc]
}t|«Œ}}|j|jj||««Scc}wcc}w)
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.
)rrˆrˆz+point operation not supported for this mode)rYÚImagePointHandlerÚpointrr{r#rJrÚpoint_transformrÙrrWr)rÚlutr{rrÚflatLutrös r%rz Image.pointÅðB
‰ Œ ä  —99˜T“?Ð CŒ=ày‰yÐ!0°Ó 4
—y‘y §¡×!8Ñ!8¸ÀÓ!GÓHä',¨S£zÖ2 !s˜1•vÒ2°T·W±W·]±]ÑB‰GàˆGà 9‰9˜Ò à?ˆCܘS“/Ð 3Š;Ø)0Ö1 A”u˜Q•xÐ1ˆGÐy‰y˜ŸŸ w°Ó6ùò3ùò2s ÂD!Ã"D&có’|j«|jdvrP t|j«dz} |jj |«|jj|_|jdvrd}nd}t|t«rL|jd vr
d}t
|«|j«|jd
k(r0|jd «}n |jj||«y|jj!|j|«y#t
t f$rI}|jj|«}|jdvrd}t
|«|||_Yd}~Œ"d}~wwxYw#t$r}d}t
|«|d}~wwxYw#t
t f$rtd |j|«}YŒÉwxYw) 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.
rbz alpha channel could not be addedNúillegal image moder¼r r2)r†r†)r\r{rÚsetmoderñrWr/rwrYÚfillbandrIr<Úputband)rrfr{rr's r%ÚputalphazImage.putalphas‰ð
×ÑÔà 9‰9Ð 
" 4§9¡9ÓÑ3ð—GG—OO "ŸW™WŸ\™\
ð
9‰9˜ Ñ ‰DàˆDä eœUÔ z‰z Ñ*Ü  “oÐ J‰JŒLØz‰z˜SÒ ØŸ
 *ð
Ø× Ñ   uÔ
à ˜Ÿ 'øôG
ПŸ¨Ó.—w‘wÐ&:Ñ@˜Üo°1Ð D—G’Gûð
!ûôò
*Ü  “o¨1Ð,ûð
-ûô*#¤JÐ
˜C §¡¨EÓ2’ð
3úsR E>¹D#ÁE>ÃFÄ#E;Ä2>E6Å0E>Å6E;Å;E>Å> FÆFÆFÆ&GÇGcó^|j«|jj|||«y)
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)r\rÚputdata)rrrrs r%rz
Image.putdata8s$ð(
×ÑÔà ˜˜e VÕ,r$cópddlm}|jdvr
d}t|«t ||j«rY|j
(|j |j
|j«}nS|j|j¬«}d|_n.t |t«s t|«}|j ||«}d|jvrdnd |_
||_|jd
«rd
|j_n'd|vrd |j_nd |j_|j«y)
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 rGrr‡r1rbr“rr‡r•r”)
rdr{rWrr1r/Ú
startswithrY)rrrdr1s r%zImage.putpalettePõ. 9‰9Ð &ˆ˜S“/Ð d˜L× |‰|Ð*˜,×*¨4¯<©<¸¿¹ÓFà3˜,×3¸D¿L¹LÔIØ !
ä˜d¤EÔ˜T“{Ø&l×& Ó5ˆ  D§I¡IÑ-‘T°3ˆŒ
؈Œ Ø × Ñ ˜fÔ %Ø &ˆDL‰LÕ Ø
G‰^Ø &ˆDL‰LÕ à %ˆDL‰LÔ Ø r$cóž|j«|jdvr”t|ttf«r~t |«dvrq|jdk(rt |«dk(r|dnd}|dd}|j J|j jt |«|«}|jdk(r|fn|}|jj||«S)
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.
rF)r2r3r“r3r2N)
r\r{r5r~r1r)rrirfÚ
palette_indexs r%zImage.putpixel€ð0
×ÑÔð
I‰I˜Ñ ˜5¤4¬ -ÔE“
˜fÑy‰y˜ Ü$'¨£J°!¢O˜˜aš¸Ø˜b˜q˜ Ø—<  ŸL™L×1´%¸³,ÀÓEˆMØ.2¯i©i¸4Ò.?] *À]ˆw‰w×Ñ  *r$cóþddlm}|jdvr
d}t|«d}d}|€y|jdk(rN|j «|j
j
«}|dk(rd }|j
j||«}n.td
td «D««}nt|«d kDrd }d}d }d
gdz}t|«D]\} }
|||
|z|
|z|zz
}| ||
<Œt|«} |j«} d| _
|j|| |z¬«| _| j
j||dz| jj!««| j#d«} | j||«|j||¬«| _d|j$vr. |j'|j$d«| j$d<| S| S#t$rd| j$vr
| j$d=Y| SwxYw)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 rG)rr‡r2r”rr•r3c3ó&K|] }|dzŒ y­w)r2Nr#©s r%z&Image.remap_palette.<locals>.<genexpr>Åsèø€Ò*F°a¨1°­6Ñ*Fùsir$rrz;LrŽ)rdr{rWrYrrnÚ bytearrayrÙr~rerHr/r1ror2Úindex)
rÚdest_mapÚsource_paletterdrÚ palette_modeÚ
palette_bytesÚ
new_positionsrÐÚ oldPositionÚmapping_paletteÚm_ims
r%Ú
remap_palettezImage.remap_palette¨sõ 9‰9˜ &ˆ˜S“/Ð ˆØˆ Ø Ð y‰y˜CÒØ— ‘ ” Ø#Ÿw™w×7 Ø EØ!%§¡×!3Ñ!3°LÀ,Ó!Oä!*Ñ*F¼5À»:Ô*FÓ!FÜ
Ó
 
ˆ!ˆˆ
ؘ˜c™ ˆ
ôÓ +‰NˆAˆ{Ø ˜˜# k°EÑ&9¸EÑ&Aðñ
ˆ*+ˆM˜  +ô0$ 2ˆày‰y‹{ˆØˆŒ
à0|×  /°EÑ"9ô
ˆŒ ð
×ј¸Ñ)<¸d¿l¹l×>RÑ>RÓ>TÔ|‰|˜ ˆà ˜
 0À}ÔUˆŒ à ˜TŸY™YÑ 
2Ø,4¯N©N¸4¿9¹9À^Ñ;TÓ,U ˜
ˆ ˆtˆ øô ò
! T§Y¡YÑŸ ™  .Ð1øàˆ ð 
2úsÆ%+GÇ$G<Ç;G<c
ó¢t|dz
}|d|dz
|dz }|d|dz
|dz }||z}||z}tdt|d|z
««tdt|d|z
««t|jdt j |d|z««t|jdt j |d|z««fS)z€Expands the box so it includes adjacent pixels
that may be used by resampling with the given resampling filter.
rLr1rr2r )Ú_filters_supportr¥r¿r<ÚmathÚceil) rr<ÚresamplerÚfilter_supportÚscale_xÚscale_yÚ support_xÚ support_ys r%Ú
_get_safe_boxzImage._get_safe_box ô*¨(Ñ3°cÑØq‘6˜C ™F‘? d¨1¡gÑ-ˆØq‘6˜C ™F? d¨1¡gÑ-ˆØ" ,ˆ Ø" ,ˆ ô
”3s˜1v  Ñ ”3s˜1‘v  Ñ — ‘ ˜!‘ œdŸi™i¨¨A©°Ñ(:Ó — ‘ ˜!‘ œdŸi™i¨¨A©°Ñ(:Ó 
ð
r$c óâ|tj}n|tjtjtjtjtj
tj fvr²d|d}tjdftjdftjdftjdftj
dftj d ffDcgc]}|d
d |d d
Œ}}|ddj|dd«d|dz
}t|«||dkr
d}t|«|d|jz}t|«}|j|k(r"|d|jzk(r|j«S|jdvrtj}|jdvrb|tjk7rO|jdddœ|j«}|j|||«}|j|j«S|j«|ú|tjk7rçt!|d|d z
|d z |z «xsd
} t!|d|d
z
|d
z |z «xsd
}
| d
kDs|
d
kDr|j#|t%t|«|«} | |
f} t'|j(«r|j)| | ¬«nt*j)|| | ¬«}|d | d z
| z |d
| d
z
|
z |d| d z
| z |d| d
z
|
z f}|jd
|jd dzkDr||d
|jd
krg|j,j|jd |d
f|d |d
|jd |df«}|j|||d d |d|d
f«}n|j,j|||«}|j/|«Scc}w)
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.
Unknown resampling filter (ú).úImage.Resampling.NEARESTúImage.Resampling.LANCZOSúImage.Resampling.BILINEARúImage.Resampling.BICUBICúImage.Resampling.BOXúImage.Resampling.HAMMINGr ú (rú Use ú, éÿÿÿÿú or rMz#reducing_gap must be 1.0 or greaterr-©r†rrrr1r2)réd)rErJrFrHrKrGrIrWr<rHr{ÚresizerYr¿rrÚreducerwrrJ)
rr<rÚ reducing_gaprörÚfiltersrÚfactor_xÚfactor_yÚ
reduce_boxÚfactors
r%z Image.resize ðL Ð Ü)ŠHØ
Ü × Ñ Ü × Ñ Ü × Ñ Ü × Ñ Ü N‰NÜ × Ñ ð

ñ
ð¨z¸Ð<ˆ
 ×'Ð)CÐ×'Ð)CÐ×(Ð*EÐ×'Ð)CЗ^^Ð%;Ð×'Ð)CÐ
ö
àð˜!‘9+˜R  q¡ ˜{¨!Ò
ˆ
ð
U˜4Ÿ9™9 W¨S¨b \Ó3°4¸À¹ °}Ð EˆCܘS“/Ð Ð °sÒ(:Ø7ˆCܘS“/Ð ˆ;ؘ4Ÿ9™9Ñ$ˆCäT‹{ˆØ 9‰9˜Ò  ¨°·±Ñ(:Ò!:Ø—9‘9“;Ð à 9‰9˜
Ñ !×)ˆ 9‰9˜Ñ &¨8´z×7IÑ7IÒ+IØ T°6Ñ:¸4¿9¹9ÑFˆBؘ4 ¨3Ó/ˆBØ—:‘:˜dŸi™iÓ  ‰ Œ à Ð ´J×4FÑ4FÒ(FܘC ™F S¨¡V™O¨t°A©wÑÑKÈ!ˆHܘC ™F S¨¡V™O¨t°A©wÑÑKÈ!ˆHؘ!Š|˜x¨!š|Ø´d¼:ÀxÓ6PÐRUÓV
Ø" -ô  § ¡ Ô—K‘K ¨JŸ d¨F¸
˜Ó𠘑V˜j¨™mÑ+¨xј‘V˜j¨™mÑ+¨xј‘V˜j¨™mÑ+¨xј‘V˜j¨™mÑ+¨xÑð 9‰9Q‰<˜$Ÿ)™) A™,¨Ñ °a±¸4¿9¹9ÀQ¹<Ò1GØØ˜1‘˜t A™wаA°s¸1±v¸t¿y¹yȹ|ÈSÐQRÉVÐ3TóˆBð˜4 ¨C°©F°A°s¸1±v¸tÀA¹wÐ+GÓH‰Bà  h°Ó4ˆBØy‰y˜‹}Ðùòy
sÃ#O,cóÔt|ttf«s||f}|d|jz}|dk(r"|d|jzk(r|j «S|j
dvrN|j
dddœ|j
«}|j||«}|j
|j
«S|j«|j|jj||««S)a!
Returns a copy of the image reduced ``factor`` times.
If the size of the image is not dividable by ``factor``,
the resulting size will be rounded up.
:param factor: A greater than 0 integer or tuple of two integers
for width and height separately.
:param box: An optional 4-tuple of ints providing
the source image region to be reduced.
The values must be within ``(0, 0, width, height)`` rectangle.
If omitted or ``None``, the entire source is used.
r-rr) r5r<rHr{rYrJr)rrrs r%z Image.reduceˆ ô"˜&¤4¬ ˜fÐ%ˆFà ˆ;ؘ4Ÿ9™9Ñ$ˆCà    · ± Ñ'9Ò 9Ø—99“;Ð à 9‰9˜Ñ  T°6Ñ:¸4¿9¹9ÑFˆ˜6 'ˆBØ—::˜dŸi™iÓ  ‰ Œ ày‰y˜ŸŸ¨°Ó5r$Fc óP|dz}|s|s|dk(r|j«S|dk(r|jtj«S|dvrS|s|j|j
k(r8|j|dk(rtj «Stj«S|j\}}|d} n|} |
|dz |dz f}tj|« }ttj|«d«ttj|«d«d ttj|« d«ttj|«d«d g}
dd
} | |d | dz
|d  | d z
|
«\|
d<|
d <|
dxx|dz
cc<|
d xx|d z
cc<|ræg} g}
d|df||fd|ffD]4\}}| |||
«\}}| j|«|
j|«Œ6tjt!| ««tj"t%| ««z
}tjt!|
««tj"t%|
««z
}| ||z
d
z ||z
d
z |
«\|
d<|
d <||}}|j'||ft(j*|
||¬«S)a
Returns a rotated copy of this image. This method returns a
copy of this image, rotated the given number of degrees counter
clockwise around its centre.
:param angle: In degrees counter clockwise.
:param resample: An optional resampling filter. This 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 expand: Optional expansion flag. If true, expands the output
image to make it large enough to hold the entire rotated image.
If false or omitted, make the output image the same size as the
input image. Note that the expand flag assumes rotation around
the center and no translation.
:param center: Optional center of rotation (a 2-tuple). Origin is
the upper left corner. Default is the center of the image.
:param translate: An optional post-rotate translation (a 2-tuple).
:param fillcolor: An optional color for area outside the rotated image.
:returns: An :py:class:`~PIL.Image.Image` object.
g€v@ré´)éZir-r1éçcóL|\}}}}}}||z||zz|z||z||zz|zfSrr#) rtrlr"r„rr¸rhs r%zImage.rotate.<locals>.transform
sAØ ˆAˆq!˜1Øq5˜1˜q™5= $ a¨!¡e¨a°!©e¡m°aÑ&7Ð 7r$r r4rN)Ú fillcolor)rtrrlrz list[float]rútuple[float, float])rHÚ transposer0r9r}r|r8r:r<ÚradiansrÚcosÚsinr¨ÚfloorrÊr>r?)rÚangler¥ÚexpandÚcenterÚ translaterÌÚwr!Ú
post_transrÑÚxxÚyyrtrlÚ
transformed_xÚ
transformed_yÚnwÚnhs r%Úrotatez Image.rotate« ðD˜
ˆñ™)ؘŠzØ—y‘y“{ИŠ|Ø—~~¤i×&:Ñ&:Ó˜ Ñ!¡v°·±¸t¿{¹{Ò1JØ—~~Ø+0°Bª;”I×ðÜ<E×<PÑ<Póðð,y‰y‰ˆˆ1à Р؉Jà"ˆ ˆ˜!e˜™U^ˆFä˜eÓä ”$—((˜5“/  ”$—((˜5“/  Ü ”4—88˜E“?Ð"  ”$—((˜5“/  ð

ˆó
A‰Yˆ A™Ñ °©¨
°ZÀ±]Ñ(BÀFó
шˆq‰ 6˜!‘9ð ˆq‹ V˜A‹ ؈q‹ V˜A‘YÑ‹ á àˆB؈BØ ! Q ¨!¨Q¨°!°Q°Ð
)1Ù/8¸¸A¸vÓ/FÑ,
˜}Ø— ‘ ˜-Ô— ‘ ˜-Õ
œ3˜r›7Ó#¤d§j¡j´°R³Ó&9Ñ9ˆBÜœ3˜r›7Ó#¤d§j¡j´°R³Ó&9Ñ9ˆ
$-¨r°A©v¨Y¸©_ÀÀQÁ¸iÈ#¹oÈvÓ#VÑ ˆF1‰Iv˜arˆqˆ~‰~Ø
ˆF”I×$ f¨hÀ)ðó
ð
r$c ód}d}t|«rtj|«}d}n.|tjk(r tjj
}|s@t|d«r4t|j«rtj|j«}|r t«nƒtjj|«dj«}t|t«r|j«n|}t!|«s
t«|t"vr
t%« t"|}ddlm}
t||
j,«rZtjj/|«tjj/|j0«k(r|j3«n|j5«|j7d d«} ||_t;|d
i«} |j=|«d |_|jA«tBvr
t%«| s)| €?|jEd «r.|jA«tFvrtF|jA«}
ntB|jA«}
d}|r`tjjI|« }|jEd
d«rtKjL|d«}n.tKjL|d«}ntOtPt|«} |
|||« | |_-|r|jU«yy#t $rYŒ¾wxYw#t&$r}d|} t)| «|d}~wwxYw#tR$r<|r|jU«|r& tjV|«#tX$rYwxYwwxYw#| |_-wxYw)
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.
FTr´r zunknown file extension: Nr£Úsave_allÚ encoderinfor#Ú
append_imagesr¨zr+bzw+b).rraÚfspathrSÚstdoutÚbufferrñrUr´ÚpathÚsplitextrÖrqrWrbÚabspathrir\rYÚpopÚ_default_encoderinforïÚ_attach_default_encoderinfoÚ
encoderconfigÚupperror×rpÚexistsÚbuiltinsÚopenrrr€rVÚremoveÚPermissionErrorrâ)rrMr*ÚparamsriÚopen_fpÚ filename_extràrbÚ save_handlerÚcreateds r%rdz
Image.save
ð\!#ˆØˆÜ 2Œ;Ü—y‘y “}ˆH؉GØ
”3—:
ð
Ü—ZZ×&ñœG Ô/´G¸B¿G¹GÔ4Dä—y‘y §¡Ó)ˆHá Ü Ÿ7™7×+¨HÓ5°aÑ8×@ˆ˜l¬EÔ×
ôÔ” àœ)Ñð
" 3™õ
ô d˜I× 0´R·W±W·_±_Ø ó6
ä
W‰W_‰_˜TŸ]™]Ó
6,ð
× Ñ Õ I‰IŒKà—::˜j¨$ÓØ$*ˆÔ˜d M°2Ó Ø ×Ô.Ø.0ˆÔà <‰<Ñ ŒFÙ Ø Ð Ø
˜?Ô ¤(Ñ# F§L¡L£NÑ3‰Lä § ¡ £Ñ/ˆLàˆÙ ÜŸ'™'Ÿ.™.¨Ó2ˆz‰z˜( EÔ—]] 8¨UÓ3‘ä—]‘] 8¨UÓ3‘ä”bœ‘i Ó$ˆB𠘘r 8Õ  +ˆDÔ Ù Ø H‰H øôa
Úð
ûô0ò
°Ð6Ü  “o¨1Ð,ûð
-ûôZò ÙØ
ÙðÜ—II˜
øôØØ ðúà ð ûð +ˆDÕ úse¼LÄ LË"
L:Ì LÌLÌ L7Ì!L2Ì2L7Ì:M?ÍM.Í-M?Í. M:Í7M?Í9M:Í:M?Í?NÎ N cóJt|di«}i|j¥|¥|_|S)Nrâ))rrs r%z!Image._attach_default_encoderinfo¨
s.ܘd M°2Ó ØE˜b×ÐÔØÐr$có(|dk7r
d}t|«y)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)rÚframerös r%Úseekz
Image.seek­
sð$ AŠ:Ø*ˆCܘ3“-Ð ð r$có4ddlm}|j||«y)
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)rÚshow)rÚtitlers r%rz
Image.showÃ
sõ( àt˜#r$cóä|j«|jjdk(r|j«fSt t |j |jj«««S)
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 )rYrrrHrPrJrs r%z Image.splitÛ
sKð
‰ Œ Ø 7‰7=‰=˜ Ø—II“K ”S˜Ÿ D§G¡G§M¡M£OÓ5r$có|j«t|t«r |j«j |«}|j
|jj|««S#t
$r}d|d}t |«|d}~wwxYw)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) rYrr—rWrJrr)rÚchannelrâs r%Ú
getchannelzImage.getchannelî
s|ð
‰ Œ ä gœsÔ 
Ÿ-™-›/×Ó8ð
y‰y˜ŸŸ¨Ó2øô ò
2°7°)¸1Ð=Ü  “o¨1Ð,ûð
-ús¢A+Á+ B Á4BÂB cóy)
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ðr$rNcóª
tttj|««Š
dˆ
ˆfd }|«}|y|}d}|9‰j dt |d|z«t |d|z«f«}||d}j |k7rH‰j||||¬«} | j_|_ jj_ d_ y)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
cóðdd}\ŠŠjk\rjk\ryjjz Šz k\r|zˆˆfd¬«ŠfS|z ˆˆfd¬«ŠfS)Ncó~tttj|«tj|«|¬«d«S)Úkeyr ))Únumberrs r%Ú round_aspectzDImage.thumbnail.<locals>.preserve_aspect_ratio.<locals>.round_aspect? s+Üœ3œtŸz™z¨&Ó1´4·9±9¸VÓ3DÈ#ÔNÐPQÓRr$có&t|z z
«Sr©r)Úaspectrls €€r%ú<lambda>z@Image.thumbnail.<locals>.preserve_aspect_ratio.<locals>.<lambda>H sø€¼3¸ÈAɹ~Ó;N€r$r
có4|dk(rdSt|z z
«Sr:r)rrrts €€r%rz@Image.thumbnail.<locals>.preserve_aspect_ratio.<locals>.<lambda>K sø€°1¸²6¨a€¼sÀ6ÈAÐPQÉEÁ>Ó?R€r$)rrrúCallable[[int], float]rr¿)r}r|)rrrtrlÚ
provided_sizers @@@€€r%Úpreserve_aspect_ratioz.Image.thumbnail.<locals>.preserve_aspect_ratio> s‡û€ó
Sð!‰DˆAˆqØD—J‘JŠ 1¨¯ © Ò#3Øà—Z‘Z $§+¡+Ñ-ˆFØ1‰u˜ŠÙ   V¡Ô1NÔOð
a4ˆKñ˜‘JÔ$Rôða4ˆKr$Nrr )rr¿)rútuple[int, int] | None)
rPrr¿r<rr0r{r/r3) rr<r¿rÚpreserved_sizeÚ
final_sizerÚresrrs ` @r%Ú thumbnailzImage.thumbnail ù€ôZœc¤$§*¡*¨dÓ
ö ñ"0ˆØ Ð Ø
àˆØ Ð —*‘*Ø”s˜4 ™7 \Ñ2´C¸¸Q¹À,Ñ8NÓ4OЈCðˆØ˜!‘fà 9‰9˜
Ò ˜Z¨°sÈÓVˆBà—e‘eˆDŒGØ#ˆDŒJØŸŸˆDŒJàˆ
r$r c
ó*|jdvra|tjk7rN|jdddœ|j«j ||||||«j|j«St |t «r|j ||||¬«St|d«r|j«\}}|
d}t|«t|j||«}|jdk(r+|jr|jj«|_ |jj«|_
|tjk(r2|D]+\} }
|j!| |tj"|
||du«Œ-|S|j!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.
rr)Úfillr'Nzmissing method datarr-)r{rErFÚImageTransformHandlerrUr'rWrIr1rHr2r>rCÚ_Image__transformerrB) rr<rr rrÚquads r%zImage.transformg suðv 9‰9˜Ñ &¨8´z×7IÑ7IÒ+Ià  D°&Ñ9¸$¿)¹)ј4 ¨¨x¸¸yÓ˜ŸÓ
ô  ×# D¨$¸ÈÐ 6˜ !Ÿ>™>Ó+‰LˆF ˆ'ˆ˜S“/Ð
˜D 
Ø 9‰9˜Ò  § ¢ ØŸ×,ˆBŒJØ—)‘)—.ŒØ ”Y—^ 
× Ñ Ø˜œyŸ~™~¨t°X¸yÈDÐ?Põð
ðˆ ð
× Ñ Ø˜
˜t V¨T°8¸YÈ$Ð=Nô
ðˆ r$c
óx|d|dz
}|d|dz
}|tjk(r|dd}nþ|tjk(r0|\} }
} } | | z
|z }
| |
z
|z }tj}|
d| d||
f}n»|tjk(r|dd}n¢|tjk(r|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}n
d }t |«|t jt jt jfvrï|t jt jt jfvr?t jd
t jd t jd i}||d
|dz}nd|d}t jdft jdft jdffDcgc]}|dd
|ddŒ}}|ddj|dd«d|dz
}t |«|j«|j«|jdvrt j}|j j#||j ||||«ycc}w)Nr1rr2r r5ér3rMzunknown transformation methodr³r´z) cannot be used.r­)r>r?r@rArBrWrErFrHrJrGrIrKrYr{r)rrÚimagerürr r×r!rr r
r ÚxsÚysrÝÚswÚseÚneÚAsÚAtröÚunusablers r%Ú
__transformerzImage.__transformerÅ s.ð
‰F‘V‰OˆØ ‰F‘V‰Oˆà ”Y× ˜˜8‰Dà
”y×
!‰NˆBB˜Ør'˜Qˆr'˜Q‘ˆBÜ×%ˆ˜˜2˜q " )‰Dà
”y×
˜˜8‰Dà
”y—~
bqˆB؈B؈B؈B؉FˆBØq‘ˆBØq‘ˆBàØA‘˜˜rÑA‘˜˜rÑA‘˜˜A™  A¡ÑÑ+¨rÑ1°BÑØA‘˜˜rÑA‘˜˜rÑA‘˜˜A™  A¡ÑÑ+¨rÑ1°BÑ ‰Dð2ˆCܘS“/Ð Ü × Ñ Ü × Ñ Ü × Ñ ð
ñ
ð
œJŸN™N¬J×,>Ñ,>Ä
×@RÑ@RЗNNÐ$:Ü×&Ð(BÜ×&Ð(Bð,ð
˜(¨R°¨zÐ9JÐ+KÑK‘à3°H°:¸@ô
 ×'Ð)CÐ×(Ð*EÐ×'Ð)CÐöàð˜!‘9+˜R  q¡ ˜{¨!ÒˆGðð
U˜4Ÿ9™9 W¨S¨b \Ó3°4¸À¹ °}Ð EˆCܘS“/Ð 
Œ à ‰ Œ à :‰:˜Ñ )ˆHà ×ј#˜uŸx™x¨°°xÀÕFùò%sÈ J7cóv|j«|j|jj|««S)
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.
)rYrJr)rs r%zImage.transpose s+ð
‰ Œ Øy‰y˜Ÿ×*¨6Ó3r$cóv|j«|j|jj|««S)zj
Randomly spread pixels in an image.
:param distance: Distance to spread pixels.
)rYrJrÚ
effect_spread)rÚdistances r%r2zImage.effect_spread) s+ð
‰ Œ Øy‰y˜Ÿ×.¨xÓ9r$códddlm}|js
d}t|«|j|«S)z#Returns a QImage copy of this imager ©reúQt bindings are not installed)reÚqt_is_installedrßÚtoqimage©rres r%r8zImage.toqimage2 s1åà×1ˆ˜ ˆw×Ñ Ó%r$códddlm}|js
d}t|«|j|«S)z$Returns a QPixmap copy of this imager r5r6)rer7Ú toqpixmapr9s r%r;zImage.toqpixmap; s1åà×1ˆ˜  ˆw× Ñ  Ó&r$©rr)rúcore.ImagingCore)rr=rr©rr¿)rútuple[int, int]©r)r3r¿rr)rr=rrw)rrw)Úobjectrr)NN)rer)r*r)rfrr)r rArr))rzrar{r)rr)rrrú bytes | None)rrB)rz.dict[str, str | bytes | int | tuple[int, ...]])rrAr)r˜z
object | Nonerztuple[object, object])rú list[Any])r rCrr©r)rr)r&)r´r)rú*bytes | bytearray | SupportsArrayInterfacerórrr)rzcore.PixelAccess | None) r{r)ztuple[float, ...] | Nonerèz
Dither | Noner1rVr¿rrw) r¿r+r¿r1ú Image | NonerèrPrrw)rú(tuple[float, float, float, float] | Nonerrw)rr=rú!tuple[float, float, float, float]rr=)r{r)r<rrz0tuple[str, tuple[int, int, float, float]] | None)rz-ImageFilter.Filter | type[ImageFilter.Filter]rrw)rútuple[str, ...])rr)rú tuple[int, int, int, int] | None))r r¿rzBlist[tuple[int, tuple[int, ...]]] | list[tuple[int, float]] | None)r'r+rr=)r'r+rz/tuple[tuple[int, ...], ...] | tuple[float, ...])rz1tuple[float, float] | tuple[tuple[int, int], ...]©rúdict[str, Any])rrE)rzlist[ImageFile.ImageFile])rrg)r”)r)rzlist[int] | None©rr))riútuple[int, int] | list[int]rzfloat | tuple[int, ...] | None)rztuple[list[int], list[int]])rprFrqútuple[float, float] | Nonerú list[int])rprFrqrOrr)rz'Image | str | float | tuple[float, ...]rz:Image | tuple[int, int, int, int] | tuple[int, int] | NonerprFrr)r-r-)rrwr{ú
Sequence[int]rxrQrr)r„zˆSequence[float] | NumpyArray | Callable[[int], float] | Callable[[ImagePointTransform], ImagePointTransform | float] | ImagePointHandlerr{r)rrw)rfz Image | intrr)rM)rzISequence[float] | Sequence[Sequence[int]] | core.ImagingCore | NumpyArrayrrrrrr)rz1ImagePalette.ImagePalette | bytes | Sequence[int]r¾rr)rir?z#float | tuple[int, ...] | list[int]rr)r˜rPr™zbytes | bytearray | Nonerrw)r<r?rErrHrútuple[int, int, int, int])NNN)
r<z(tuple[int, int] | list[int] | NumpyArrayr¥r+rrGr¿ú float | Nonerrw)zint | tuple[int, int]rrJrrw)rrEz
int | boolrÕrOrú&float | tuple[float, ...] | str | Nonerrw)rMúStrOrBytesPath | IO[bytes]r*r)rrr)rrwrrL)r¿rr)rr)rr)rztuple[Image, ...])rz int | strrrw)r<rEr¿rSrr)r<r?z3Transform | ImageTransformHandler | SupportsGetDatarzSequence[Any] | Noner¥r¿r r¿rTrrw)rrRr&rwr>rzSequence[float]r¥r¿r r)rr)r0rrw)r3r¿rrw)rzImageQt.ImageQt)rúImageQt.QPixmap)cr r!r"rr*Ú__annotations__r+Ú!_close_exclusive_fp_after_loadingrÚpropertyrÚsetterr}r|r<r{r3rJrLrNrVrZr\rjrprwr|r…rrr”rrrorYrVrWrPrTrHÚ__copy__rrrrrrrr'r%r+r@rWrYr\r_rnrcrgrkrrsrwrzrrrr rErFrdrrr rJrr"r2r8r;r#r$r%rwrwiscñ ð€FˆJÓØ%)И
Ó)Ø(,Ðòóðð ‡YóððòóððòóððòóððòóððòBóðBð‡_ð
ó ó
óJó(ó
ð=AðØðØ/9ðØMPðà óó0

ó
ó
ó óò
óð
ó
15ðKØ -ðKà óKó Mó ô7 ôr
ð:##ð#ð #
ó #"óJ$óL 
ð Ø+/Ø $Ø"Ÿ;™;Øð
~àð~ð~ðð ~ð
ð ~ð ð
~ð
ó~ðDØØ $Ø×
QàðQððQðð Qð
ð Qð ð
Qð
óQóf €Hô3ð4)Ø)Jðó)ð,
Øð
Ø&<ð
à 9ó
ó2%ó6-1õ+ð(ð,à Kó,ô2ð2"&ðØðà 8óó$
%5óN)óVó  ô7ð,òóðó*&ð0

+à 'ó

 ðPTð ð#Ø2Lðó#ðDPTð ð!Ø2Lðó!ð>KOØ!ð Z ZHðZð Z
ó Z'ðzPVð6 Øð6 Ø6 Ø?Lð6 à
ó6 ðB ð:
ð:ð:
ó:7óx5(ðtØð ðð 
ó -ð6ð.à.ðð.ð
ó .ð`&&+Ø*Mð&
ó&+ðROSðXØXØ3KðXà óXðt
àð
ðð
ð
ð

ð2 $Ø8<Ø%)ð nànððnð6ð nð
 nð
ó
nðf15ð!!!
ó !6ðL *×"Ø-1Ø,0Ø<@ðr
àðr
ððr
ðð r
ð
 r
ð 
r
ðr
ð
ór
ðjDHðGØGØ6@ðGØSVðGà
óGóRó
 ô,$ó06ó&3ó, ð *×1Ø%(ð TàTððTð#ð Tð
ó Tðx&*Ø"ר<@ð\àð\ðDð\ð#ð \ð
ð \ð ð
\ð\ð
ó\ðH#×ðTGà
TGððTGðð TGð
ð TGð ð
TGððTGð
óTGól 'r$có6eZdZdZej
dd«Zy)rzb
Used as a mixin by point transforms
(for use with :py:meth:`~PIL.Image.Image.point`)
cóyrr#r8s r%rzImagePointHandler.pointO sà r$N)rrwrrw)r r!r"rÚabcÚabstractmethodrr#r$r%rrI s!ñð
 ×Ñò
óñ
r$rcóFeZdZdZej
dd«Zy)r!zi
Used as a mixin by geometry transforms
(for use with :py:meth:`~PIL.Image.Image.transform`)
c óyrr#)rr<r&rfs r%zImageTransformHandler.transformZ sð
r$N)r<r?r&rwrfrrrw)r r!r"rr^r_r#r$r%r!r!T sGñð
 ×Ñð
àð
ðð
ðð 
ð
ò 
óñ
r$r!cóºt|ttf«s
d}t|«t |«dk7r
d}t|«|ddks|ddkr
d}t|«y)
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)r5rWr~)r<s r%Ú _check_sizerch sdô dœT¤5˜MÔ Ü˜‹oÐÜ
ˆ4ƒyA‚~ØÜ˜‹oÐØ ˆAw‚{d˜1‘g ’kØ-ˆÜ˜ð"r$cójt|«|€-t«jtj||««St |t «rddlm}|j||«}t«}|dk(rt |ttf«r‡td|D««rutttdft|««}t|«dk(st|«dk(r7ddlm}|j «|_|j"j|«}|jtj$|||««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.
r rurc3ó<K|]}t|t«Œy­wr)r¿r•s r%znew.<locals>.<genexpr>  sèø€Ò2 q”
˜1œc×2ùs.r2r3rG)rcrwrJrIrvr5Úallrr¿r~rdr1r )r{r<ÚcolorrvrÚ
color_intsrds r%rIrI{ ô(Ôà €}ä‹w|‰|œDŸH™H T¨4ÓÔõ×# E¨4Óä €Bà Š Ü uœt¤U˜mÔ Ñ2¨EÔ 2ä&*¬5´°c°©?¼EÀ%»LÓ&Iˆ
Ü ˆz‹?˜ ¤3 z£?°aÒ#7å 2˜×4ˆBŒJØ—JJ×
Ó3ˆ
7‰7”4—99˜T Ó 0r$cóþt|«t||«}|jdk7rV|jdk7rG|}t |«dk(rt |dt «r|d}|dk(r|dk(r|}|j|||«|S)
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 <file-codecs>`.
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#)rcrIr}r|r~)r{r<rrs r%¬ s}ô<Ôä ˆT4€BØ ‡xx1‚}˜Ÿ ašØ ˆ Ü ˆ|Ó  Ò !¤j°¸Ä%Ô&Hà™?ˆ ˜  \°RÒ%7؈Là
T˜Ô
€Ir$c ó¨t|«t|«dk(rt|dt«r|d}|dk(rŽ|dk(r|ddf}|dtvryt |d«}|j
tj|||d|««}|dk(r7ddl m
}|jd|jjd««|_
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#r-rrGr”)rcr~Ú _MAPMODESrIrJÚ
map_bufferrærdrrnr1r3)r{r<rrrds r%Ú
frombufferrmÚ ôPÔô ˆ4ƒyA‚~œ* T¨!¡W¬eÔA‰wˆàØ 2Š:ؘ˜A:ˆDØ ‰7”iÑ ÜT˜6Ó"ˆBØœŸ¨¨t°\À1ÀdÓLˆBØsŠ{Ý6˜\×6°u¸b¿e¹e×>NÑ>NÈuÓ>UÓV
؈BŒK؈Iä T˜4  |°TÓ :r$có"eZdZdZedd«Zy)ÚSupportsArrayInterfacezC
An object that has an ``__array_interface__`` dictionary.
cót«r©ÚNotImplementedErrorrs r%rz*SupportsArrayInterface.__array_interface__
s ä#r$NrK)r r!r"rrYrr#r$r%roro
sñðòñ$r$rocó"eZdZdZ d ddZy)ÚSupportsArrowArrayInterfacezm
An object that has an ``__arrow_c_array__`` method corresponding to the arrow c
data interface.
Ncót«rrqr—s r%rz-SupportsArrowArrayInterface.__arrow_c_array__(
s
ô#r$r)r˜z 'PyCapsule'rztuple['PyCapsule', 'PyCapsule'])r r!r"rrr#r$r%rtrt"
s!ñð /3ð$Ø +ð$à (ô$r$rtc ó¦|j}|d}t|«}|jdd«} d|ddz|df}| t
|\}
} }||
k7r|vr t
d
d «|} n
}|d vrd}n
|d
k(rd}nd}||kDrd|d|d} t| «|dk(rdn|d|df}|Gt|d«r|j«}n*t|d«r|j«}n
d} t| «t|||d dd«S#t$r}|d}g}nd} t | «|Yd}~Œäd}~wwxYw#t$r}|\} }
d| d |
} t | «|d}~wwxYw)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
ÚstridesNrÔr1r€zCannot handle this data typezCannot handle this data type: r¸z('mode' parameter for changing data typesr[)r†rrˆr”r2r3zToo many dimensions: z > rÑr rroÚtostringz1'strides' requires either tobytes() or tostring()r) rr~r×rÚ_fromarray_typemaprrWrUrorxrm)Úobjr{ÚndimrwÚtypekeyrâÚ color_modesröÚtypemoder¾Ú
typekey_shaper€Úndmaxr<s r%Ú fromarrayr.
ðL ×
!€CØ ‰L€EÜ ˆu:€DØg‰gi Ó&€Gð˜5  ˜$ c¨)¡nÐðÐð (Ü-?ÀÑ-HÑ *ˆHg˜
 ÐØ   ¨KÑ 7Ü Ð@À"Ô àˆØ ÐØ
ŠØàˆØ ˆe‚|Ø% d V¨3¨u¨g°QÐܘ‹oÐà˜’ ‰1˜u Q™x¨¨q©Ð 1€DØÐÜ 3˜ Ô —++“-‰CÜ
S˜
—,‘,“.‰CàEˆCܘS“/Ð d˜D # u¨g°q¸ <øôQ ò Р؈GØ%'‰Kà0ˆ˜C“.  
ûð(ûôò (Ø%,Ñ "ˆM˜2°=°/ÀÀGÀ9ÐMˆ˜C“.  'ûð (ús/°
C>Á
D)Ã> D&ÄD!Ä!D&Ä) EÄ2E Å EcóÚt|d«s
d}t|«|j«\}}tj||||«}|rt «j
|«Sd}t|«)a×Creates an image with zero-copy shared memory from an object exporting
the arrow_c_array interface protocol::
from PIL import Image
import pyarrow as pa
arr = pa.array([0]*(5*5*4), type=pa.uint8())
im = Image.fromarrow(arr, 'RGBA', (5, 5))
If the data representation of the ``obj`` is not compatible with
Pillow internal storage, a ValueError is raised.
Pillow images can also be converted to Arrow objects::
from PIL import Image
import pyarrow as pa
im = Image.open('hopper.jpg')
arr = pa.array(im)
As with array support, when converting Pillow images to arrays,
only pixel values are transferred. This means that P and PA mode
images will lose their palette.
:param obj: Object with an arrow_c_array interface
:param mode: Image mode.