Plugin reference (original) (raw)

AvifImagePlugin module

class PIL.AvifImagePlugin.AvifImageFile(fp: StrOrBytesPath | IO[bytes], filename: str | bytes | None = None)[source]

Bases: ImageFile

format_: str | None_ = 'AVIF'

format_description_: str | None_ = 'AVIF image'

load() → Image.core.PixelAccess | None[source]

Load image data based on tile list

load_seek(pos: int) → None[source]

seek(frame: int) → None[source]

Seeks to the given frame in this sequence file. If you seek beyond the end of the sequence, the method raises anEOFError exception. When a sequence file is opened, the library automatically seeks to frame 0.

See tell().

If defined, n_frames refers to the number of available frames.

Parameters:

frame – Frame number, starting at 0.

Raises:

EOFError – If the call attempts to seek beyond the end of the sequence.

tell() → int[source]

Returns the current frame number. See seek().

If defined, n_frames refers to the number of available frames.

Returns:

Frame number, starting with 0.

PIL.AvifImagePlugin.get_codec_version(codec_name: str) → str | None[source]

BmpImagePlugin module

class PIL.BmpImagePlugin.BmpImageFile(fp: StrOrBytesPath | IO[bytes], filename: str | bytes | None = None)[source]

Bases: ImageFile

Image plugin for the Windows Bitmap format (BMP)

BITFIELDS = 3

COMPRESSIONS = {'BITFIELDS': 3, 'JPEG': 4, 'PNG': 5, 'RAW': 0, 'RLE4': 2, 'RLE8': 1}

JPEG = 4

PNG = 5

RAW = 0

RLE4 = 2

RLE8 = 1

format_: str | None_ = 'BMP'

format_description_: str | None_ = 'Windows Bitmap'

k = 'PNG'

v = 5

class PIL.BmpImagePlugin.BmpRleDecoder(mode: str, *args: Any)[source]

Bases: PyDecoder

decode(buffer: bytes | SupportsArrayInterface) → tuple[int, int][source]

Override to perform the decoding process.

Parameters:

buffer – A bytes object with the data to be decoded.

Returns:

A tuple of (bytes consumed, errcode). If finished with decoding return -1 for the bytes consumed. Err codes are from ImageFile.ERRORS.

class PIL.BmpImagePlugin.DibImageFile(fp: StrOrBytesPath | IO[bytes], filename: str | bytes | None = None)[source]

Bases: BmpImageFile

format_: str | None_ = 'DIB'

format_description_: str | None_ = 'Windows Bitmap'

BufrStubImagePlugin module

class PIL.BufrStubImagePlugin.BufrStubImageFile(fp: StrOrBytesPath | IO[bytes], filename: str | bytes | None = None)[source]

Bases: StubImageFile

format_: str | None_ = 'BUFR'

format_description_: str | None_ = 'BUFR'

PIL.BufrStubImagePlugin.register_handler(handler: StubHandler | None) → None[source]

Install application-specific BUFR image handler.

Parameters:

handler – Handler object.

CurImagePlugin module

class PIL.CurImagePlugin.CurImageFile(fp: StrOrBytesPath | IO[bytes], filename: str | bytes | None = None)[source]

Bases: BmpImageFile

format_: str | None_ = 'CUR'

format_description_: str | None_ = 'Windows Cursor'

DcxImagePlugin module

class PIL.DcxImagePlugin.DcxImageFile(fp: StrOrBytesPath | IO[bytes], filename: str | bytes | None = None)[source]

Bases: PcxImageFile

format_: str | None_ = 'DCX'

format_description_: str | None_ = 'Intel DCX'

seek(frame: int) → None[source]

Seeks to the given frame in this sequence file. If you seek beyond the end of the sequence, the method raises anEOFError exception. When a sequence file is opened, the library automatically seeks to frame 0.

See tell().

If defined, n_frames refers to the number of available frames.

Parameters:

frame – Frame number, starting at 0.

Raises:

EOFError – If the call attempts to seek beyond the end of the sequence.

tell() → int[source]

Returns the current frame number. See seek().

If defined, n_frames refers to the number of available frames.

Returns:

Frame number, starting with 0.

DdsImagePlugin module

A Pillow plugin for .dds files (S3TC-compressed aka DXTC) Jerome Leclanche <jerome@leclan.ch>

Documentation:https://web.archive.org/web/20170802060935/http://oss.sgi.com/projects/ogl-sample/registry/EXT/texture_compression_s3tc.txt

The contents of this file are hereby released in the public domain (CC0) Full text of the CC0 license:https://creativecommons.org/publicdomain/zero/1.0/

class PIL.DdsImagePlugin.D3DFMT(*values)[source]

Bases: IntEnum

A1 = 118

A16B16G16R16 = 36

A16B16G16R16F = 113

A1R5G5B5 = 25

A2B10G10R10 = 31

A2B10G10R10_XR_BIAS = 119

A2R10G10B10 = 35

A2W10V10U10 = 67

A32B32G32R32F = 116

A4L4 = 52

A4R4G4B4 = 26

A8 = 28

A8B8G8R8 = 32

A8L8 = 51

A8P8 = 40

A8R3G3B2 = 29

A8R8G8B8 = 21

ATI1 = 826889281

ATI2 = 843666497

BC4S = 1395934018

BC4U = 1429488450

BC5S = 1395999554

BC5U = 1429553986

BINARYBUFFER = 199

CxV8U8 = 117

D15S1 = 73

D16 = 80

D16_LOCKABLE = 70

D24FS8 = 83

D24S8 = 75

D24X4S4 = 79

D24X8 = 77

D32 = 71

D32F_LOCKABLE = 82

D32_LOCKABLE = 84

DX10 = 808540228

DXT1 = 827611204

DXT2 = 844388420

DXT3 = 861165636

DXT4 = 877942852

DXT5 = 894720068

G16R16 = 34

G16R16F = 112

G32R32F = 115

G8R8_G8B8 = 1111970375

INDEX16 = 101

INDEX32 = 102

L16 = 81

L6V5U5 = 61

L8 = 50

MULTI2_ARGB8 = 827606349

P8 = 41

Q16W16V16U16 = 110

Q8W8V8U8 = 63

R16F = 111

R32F = 114

R3G3B2 = 27

R5G6B5 = 23

R8G8B8 = 20

R8G8_B8G8 = 1195525970

S8_LOCKABLE = 85

UNKNOWN = 0

UYVY = 1498831189

V16U16 = 64

V8U8 = 60

VERTEXDATA = 100

X1R5G5B5 = 24

X4R4G4B4 = 30

X8B8G8R8 = 33

X8L8V8U8 = 62

X8R8G8B8 = 22

YUY2 = 844715353

class PIL.DdsImagePlugin.DDPF(*values)[source]

Bases: IntFlag

ALPHA = 2

ALPHAPIXELS = 1

FOURCC = 4

LUMINANCE = 131072

PALETTEINDEXED8 = 32

RGB = 64

class PIL.DdsImagePlugin.DDSCAPS(*values)[source]

Bases: IntFlag

COMPLEX = 8

MIPMAP = 4194304

TEXTURE = 4096

class PIL.DdsImagePlugin.DDSCAPS2(*values)[source]

Bases: IntFlag

CUBEMAP = 512

CUBEMAP_NEGATIVEX = 2048

CUBEMAP_NEGATIVEY = 8192

CUBEMAP_NEGATIVEZ = 32768

CUBEMAP_POSITIVEX = 1024

CUBEMAP_POSITIVEY = 4096

CUBEMAP_POSITIVEZ = 16384

VOLUME = 2097152

class PIL.DdsImagePlugin.DDSD(*values)[source]

Bases: IntFlag

CAPS = 1

DEPTH = 8388608

HEIGHT = 2

LINEARSIZE = 524288

MIPMAPCOUNT = 131072

PITCH = 8

PIXELFORMAT = 4096

WIDTH = 4

class PIL.DdsImagePlugin.DXGI_FORMAT(*values)[source]

Bases: IntEnum

A8P8 = 114

A8_UNORM = 65

AI44 = 111

AYUV = 100

B4G4R4A4_UNORM = 115

B5G5R5A1_UNORM = 86

B5G6R5_UNORM = 85

B8G8R8A8_TYPELESS = 90

B8G8R8A8_UNORM = 87

B8G8R8A8_UNORM_SRGB = 91

B8G8R8X8_TYPELESS = 92

B8G8R8X8_UNORM = 88

B8G8R8X8_UNORM_SRGB = 93

BC1_TYPELESS = 70

BC1_UNORM = 71

BC1_UNORM_SRGB = 72

BC2_TYPELESS = 73

BC2_UNORM = 74

BC2_UNORM_SRGB = 75

BC3_TYPELESS = 76

BC3_UNORM = 77

BC3_UNORM_SRGB = 78

BC4_SNORM = 81

BC4_TYPELESS = 79

BC4_UNORM = 80

BC5_SNORM = 84

BC5_TYPELESS = 82

BC5_UNORM = 83

BC6H_SF16 = 96

BC6H_TYPELESS = 94

BC6H_UF16 = 95

BC7_TYPELESS = 97

BC7_UNORM = 98

BC7_UNORM_SRGB = 99

D16_UNORM = 55

D24_UNORM_S8_UINT = 45

D32_FLOAT = 40

D32_FLOAT_S8X24_UINT = 20

G8R8_G8B8_UNORM = 69

IA44 = 112

NV11 = 110

NV12 = 103

OPAQUE_420 = 106

P010 = 104

P016 = 105

P208 = 130

P8 = 113

R10G10B10A2_TYPELESS = 23

R10G10B10A2_UINT = 25

R10G10B10A2_UNORM = 24

R10G10B10_XR_BIAS_A2_UNORM = 89

R11G11B10_FLOAT = 26

R16G16B16A16_FLOAT = 10

R16G16B16A16_SINT = 14

R16G16B16A16_SNORM = 13

R16G16B16A16_TYPELESS = 9

R16G16B16A16_UINT = 12

R16G16B16A16_UNORM = 11

R16G16_FLOAT = 34

R16G16_SINT = 38

R16G16_SNORM = 37

R16G16_TYPELESS = 33

R16G16_UINT = 36

R16G16_UNORM = 35

R16_FLOAT = 54

R16_SINT = 59

R16_SNORM = 58

R16_TYPELESS = 53

R16_UINT = 57

R16_UNORM = 56

R1_UNORM = 66

R24G8_TYPELESS = 44

R24_UNORM_X8_TYPELESS = 46

R32G32B32A32_FLOAT = 2

R32G32B32A32_SINT = 4

R32G32B32A32_TYPELESS = 1

R32G32B32A32_UINT = 3

R32G32B32_FLOAT = 6

R32G32B32_SINT = 8

R32G32B32_TYPELESS = 5

R32G32B32_UINT = 7

R32G32_FLOAT = 16

R32G32_SINT = 18

R32G32_TYPELESS = 15

R32G32_UINT = 17

R32G8X24_TYPELESS = 19

R32_FLOAT = 41

R32_FLOAT_X8X24_TYPELESS = 21

R32_SINT = 43

R32_TYPELESS = 39

R32_UINT = 42

R8G8B8A8_SINT = 32

R8G8B8A8_SNORM = 31

R8G8B8A8_TYPELESS = 27

R8G8B8A8_UINT = 30

R8G8B8A8_UNORM = 28

R8G8B8A8_UNORM_SRGB = 29

R8G8_B8G8_UNORM = 68

R8G8_SINT = 52

R8G8_SNORM = 51

R8G8_TYPELESS = 48

R8G8_UINT = 50

R8G8_UNORM = 49

R8_SINT = 64

R8_SNORM = 63

R8_TYPELESS = 60

R8_UINT = 62

R8_UNORM = 61

R9G9B9E5_SHAREDEXP = 67

SAMPLER_FEEDBACK_MIN_MIP_OPAQUE = 189

SAMPLER_FEEDBACK_MIP_REGION_USED_OPAQUE = 190

UNKNOWN = 0

V208 = 131

V408 = 132

X24_TYPELESS_G8_UINT = 47

X32_TYPELESS_G8X24_UINT = 22

Y210 = 108

Y216 = 109

Y410 = 101

Y416 = 102

YUY2 = 107

class PIL.DdsImagePlugin.DdsImageFile(fp: StrOrBytesPath | IO[bytes], filename: str | bytes | None = None)[source]

Bases: ImageFile

format_: str | None_ = 'DDS'

format_description_: str | None_ = 'DirectDraw Surface'

load_seek(pos: int) → None[source]

class PIL.DdsImagePlugin.DdsRgbDecoder(mode: str, *args: Any)[source]

Bases: PyDecoder

decode(buffer: bytes | SupportsArrayInterface) → tuple[int, int][source]

Override to perform the decoding process.

Parameters:

buffer – A bytes object with the data to be decoded.

Returns:

A tuple of (bytes consumed, errcode). If finished with decoding return -1 for the bytes consumed. Err codes are from ImageFile.ERRORS.

EpsImagePlugin module

class PIL.EpsImagePlugin.EpsImageFile(fp: StrOrBytesPath | IO[bytes], filename: str | bytes | None = None)[source]

Bases: ImageFile

EPS File Parser for the Python Imaging Library

format_: str | None_ = 'EPS'

format_description_: str | None_ = 'Encapsulated Postscript'

load(scale: int = 1, transparency: bool = False) → Image.core.PixelAccess | None[source]

Load image data based on tile list

load_seek(pos: int) → None[source]

mode_map = {1: 'L', 2: 'LAB', 3: 'RGB', 4: 'CMYK'}

PIL.EpsImagePlugin.Ghostscript(tile: list[ImageFile._Tile], size: tuple[int, int], fp: IO[bytes], scale: int = 1, transparency: bool = False) → Image.core.ImagingCore[source]

Render an image using Ghostscript

PIL.EpsImagePlugin.has_ghostscript() → bool[source]

FitsImagePlugin module

class PIL.FitsImagePlugin.FitsGzipDecoder(mode: str, *args: Any)[source]

Bases: PyDecoder

decode(buffer: bytes | SupportsArrayInterface) → tuple[int, int][source]

Override to perform the decoding process.

Parameters:

buffer – A bytes object with the data to be decoded.

Returns:

A tuple of (bytes consumed, errcode). If finished with decoding return -1 for the bytes consumed. Err codes are from ImageFile.ERRORS.

class PIL.FitsImagePlugin.FitsImageFile(fp: StrOrBytesPath | IO[bytes], filename: str | bytes | None = None)[source]

Bases: ImageFile

format_: str | None_ = 'FITS'

format_description_: str | None_ = 'FITS'

FliImagePlugin module

class PIL.FliImagePlugin.FliImageFile(fp: StrOrBytesPath | IO[bytes], filename: str | bytes | None = None)[source]

Bases: ImageFile

format_: str | None_ = 'FLI'

format_description_: str | None_ = 'Autodesk FLI/FLC Animation'

seek(frame: int) → None[source]

Seeks to the given frame in this sequence file. If you seek beyond the end of the sequence, the method raises anEOFError exception. When a sequence file is opened, the library automatically seeks to frame 0.

See tell().

If defined, n_frames refers to the number of available frames.

Parameters:

frame – Frame number, starting at 0.

Raises:

EOFError – If the call attempts to seek beyond the end of the sequence.

tell() → int[source]

Returns the current frame number. See seek().

If defined, n_frames refers to the number of available frames.

Returns:

Frame number, starting with 0.

FpxImagePlugin module

class PIL.FpxImagePlugin.FpxImageFile(fp: StrOrBytesPath | IO[bytes], filename: str | bytes | None = None)[source]

Bases: ImageFile

close() → None[source]

Closes the file pointer, if possible.

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 theload() method. See File handling in Pillow for more information.

format_: str | None_ = 'FPX'

format_description_: str | None_ = 'FlashPix'

load() → Image.core.PixelAccess | None[source]

Load image data based on tile list

GbrImagePlugin module

class PIL.GbrImagePlugin.GbrImageFile(fp: StrOrBytesPath | IO[bytes], filename: str | bytes | None = None)[source]

Bases: ImageFile

format_: str | None_ = 'GBR'

format_description_: str | None_ = 'GIMP brush file'

load() → Image.core.PixelAccess | None[source]

Load image data based on tile list

GifImagePlugin module

class PIL.GifImagePlugin.GifImageFile(fp: StrOrBytesPath | IO[bytes], filename: str | bytes | None = None)[source]

Bases: ImageFile

data() → bytes | None[source]

format_: str | None_ = 'GIF'

format_description_: str | None_ = 'Compuserve GIF'

global_palette = None

property is_animated_: bool_[source]

load_end() → None[source]

load_prepare() → None[source]

property n_frames_: int_

seek(frame: int) → None[source]

Seeks to the given frame in this sequence file. If you seek beyond the end of the sequence, the method raises anEOFError exception. When a sequence file is opened, the library automatically seeks to frame 0.

See tell().

If defined, n_frames refers to the number of available frames.

Parameters:

frame – Frame number, starting at 0.

Raises:

EOFError – If the call attempts to seek beyond the end of the sequence.

tell() → int[source]

Returns the current frame number. See seek().

If defined, n_frames refers to the number of available frames.

Returns:

Frame number, starting with 0.

PIL.GifImagePlugin.LOADING_STRATEGY = LoadingStrategy.RGB_AFTER_FIRST

Added in version 9.1.0.

class PIL.GifImagePlugin.LoadingStrategy(*values)[source]

Bases: IntEnum

Added in version 9.1.0.

RGB_AFTER_DIFFERENT_PALETTE_ONLY = 1

RGB_AFTER_FIRST = 0

RGB_ALWAYS = 2

PIL.GifImagePlugin.get_interlace(im: Image) → int[source]

PIL.GifImagePlugin.getdata(im: Image, offset: tuple[int, int] = (0, 0), **params: Any) → list[bytes][source]

Legacy Method

Return a list of strings representing this image. The first string is a local image header, the rest contains encoded image data.

To specify duration, add the time in milliseconds, e.g. getdata(im_frame, duration=1000)

Parameters:

Returns:

List of bytes containing GIF encoded frame data

Legacy Method to get Gif data from image.

Warning:: May modify image data.

Parameters:

Returns:

tuple of(list of header items, optimized palette)

GribStubImagePlugin module

class PIL.GribStubImagePlugin.GribStubImageFile(fp: StrOrBytesPath | IO[bytes], filename: str | bytes | None = None)[source]

Bases: StubImageFile

format_: str | None_ = 'GRIB'

format_description_: str | None_ = 'GRIB'

PIL.GribStubImagePlugin.register_handler(handler: StubHandler | None) → None[source]

Install application-specific GRIB image handler.

Parameters:

handler – Handler object.

Hdf5StubImagePlugin module

class PIL.Hdf5StubImagePlugin.HDF5StubImageFile(fp: StrOrBytesPath | IO[bytes], filename: str | bytes | None = None)[source]

Bases: StubImageFile

format_: str | None_ = 'HDF5'

format_description_: str | None_ = 'HDF5'

PIL.Hdf5StubImagePlugin.register_handler(handler: StubHandler | None) → None[source]

Install application-specific HDF5 image handler.

Parameters:

handler – Handler object.

IcnsImagePlugin module

class PIL.IcnsImagePlugin.IcnsFile(fobj: IO[bytes])[source]

Bases: object

SIZES = {(16, 16, 1): [(b'icp4', <function read_png_or_jpeg2000>), (b'is32', <function read_32>), (b's8mk', <function read_mk>)], (16, 16, 2): [(b'ic11', <function read_png_or_jpeg2000>)], (32, 32, 1): [(b'icp5', <function read_png_or_jpeg2000>), (b'il32', <function read_32>), (b'l8mk', <function read_mk>)], (32, 32, 2): [(b'ic12', <function read_png_or_jpeg2000>)], (48, 48, 1): [(b'ih32', <function read_32>), (b'h8mk', <function read_mk>)], (64, 64, 1): [(b'icp6', <function read_png_or_jpeg2000>)], (128, 128, 1): [(b'ic07', <function read_png_or_jpeg2000>), (b'it32', <function read_32t>), (b't8mk', <function read_mk>)], (128, 128, 2): [(b'ic13', <function read_png_or_jpeg2000>)], (256, 256, 1): [(b'ic08', <function read_png_or_jpeg2000>)], (256, 256, 2): [(b'ic14', <function read_png_or_jpeg2000>)], (512, 512, 1): [(b'ic09', <function read_png_or_jpeg2000>)], (512, 512, 2): [(b'ic10', <function read_png_or_jpeg2000>)]}

bestsize() → tuple[int, int, int][source]

dataforsize(size: tuple[int, int, int]) → dict[str, Image][source]

Get an icon resource as {channel: array}. Note that the arrays are bottom-up like windows bitmaps and will likely need to be flipped or transposed in some way.

getimage(size: tuple[int, int] | tuple[int, int, int] | None = None) → Image[source]

itersizes() → list[tuple[int, int, int]][source]

class PIL.IcnsImagePlugin.IcnsImageFile(fp: StrOrBytesPath | IO[bytes], filename: str | bytes | None = None)[source]

Bases: ImageFile

PIL image support for Mac OS .icns files. Chooses the best resolution, but will possibly load a different size image if you mutate the size attribute before calling ‘load’.

The info dictionary has a key ‘sizes’ that is a list of sizes that the icns file has.

format_: str | None_ = 'ICNS'

format_description_: str | None_ = 'Mac OS icns resource'

load(scale: int | None = None) → Image.core.PixelAccess | None[source]

Load image data based on tile list

property size_: tuple[int, int] | tuple[int, int, int]_

PIL.IcnsImagePlugin.read_32(fobj: IO[bytes], start_length: tuple[int, int], size: tuple[int, int, int]) → dict[str, Image][source]

Read a 32bit RGB icon resource. Seems to be either uncompressed or an RLE packbits-like scheme.

PIL.IcnsImagePlugin.read_32t(fobj: IO[bytes], start_length: tuple[int, int], size: tuple[int, int, int]) → dict[str, Image][source]

PIL.IcnsImagePlugin.read_mk(fobj: IO[bytes], start_length: tuple[int, int], size: tuple[int, int, int]) → dict[str, Image][source]

PIL.IcnsImagePlugin.read_png_or_jpeg2000(fobj: IO[bytes], start_length: tuple[int, int], size: tuple[int, int, int]) → dict[str, Image][source]

IcoImagePlugin module

class PIL.IcoImagePlugin.IcoFile(buf: IO[bytes])[source]

Bases: object

frame(idx: int) → Image[source]

Get an image from frame idx

getentryindex(size: tuple[int, int], bpp: int | bool = False) → int[source]

getimage(size: tuple[int, int], bpp: int | bool = False) → Image[source]

Get an image from the icon

sizes() → set[tuple[int, int]][source]

Get a set of all available icon sizes and color depths.

class PIL.IcoImagePlugin.IcoImageFile(fp: StrOrBytesPath | IO[bytes], filename: str | bytes | None = None)[source]

Bases: ImageFile

PIL read-only image support for Microsoft Windows .ico files.

By default the largest resolution image in the file will be loaded. This can be changed by altering the ‘size’ attribute before calling ‘load’.

The info dictionary has a key ‘sizes’ that is a list of the sizes available in the icon file.

Handles classic, XP and Vista icon formats.

When saving, PNG compression is used. Support for this was only added in Windows Vista. If you are unable to view the icon in Windows, convert the image to “RGBA” mode before saving.

This plugin is a refactored version of Win32IconImagePlugin by Bryan Davis <casadebender@gmail.com>.https://code.google.com/archive/p/casadebender/wikis/Win32IconImagePlugin.wiki

format_: str | None_ = 'ICO'

format_description_: str | None_ = 'Windows Icon'

load() → Image.core.PixelAccess | None[source]

Load image data based on tile list

load_seek(pos: int) → None[source]

property size_: tuple[int, int]_

Bases: NamedTuple

Alias for field number 5

Alias for field number 10

Alias for field number 8

Alias for field number 1

Alias for field number 2

Alias for field number 7

Alias for field number 4

Alias for field number 3

Alias for field number 6

Alias for field number 9

Alias for field number 0

ImImagePlugin module

class PIL.ImImagePlugin.ImImageFile(fp: StrOrBytesPath | IO[bytes], filename: str | bytes | None = None)[source]

Bases: ImageFile

format_: str | None_ = 'IM'

format_description_: str | None_ = 'IFUNC Image Memory'

property is_animated_: bool_

property n_frames_: int_

seek(frame: int) → None[source]

Seeks to the given frame in this sequence file. If you seek beyond the end of the sequence, the method raises anEOFError exception. When a sequence file is opened, the library automatically seeks to frame 0.

See tell().

If defined, n_frames refers to the number of available frames.

Parameters:

frame – Frame number, starting at 0.

Raises:

EOFError – If the call attempts to seek beyond the end of the sequence.

tell() → int[source]

Returns the current frame number. See seek().

If defined, n_frames refers to the number of available frames.

Returns:

Frame number, starting with 0.

PIL.ImImagePlugin.number(s: Any) → float[source]

ImtImagePlugin module

class PIL.ImtImagePlugin.ImtImageFile(fp: StrOrBytesPath | IO[bytes], filename: str | bytes | None = None)[source]

Bases: ImageFile

format_: str | None_ = 'IMT'

format_description_: str | None_ = 'IM Tools'

IptcImagePlugin module

class PIL.IptcImagePlugin.IptcImageFile(fp: StrOrBytesPath | IO[bytes], filename: str | bytes | None = None)[source]

Bases: ImageFile

field() → tuple[tuple[int, int] | None, int][source]

format_: str | None_ = 'IPTC'

format_description_: str | None_ = 'IPTC/NAA'

getint(key: tuple[int, int]) → int[source]

load() → Image.core.PixelAccess | None[source]

Load image data based on tile list

PIL.IptcImagePlugin.dump(c: Sequence[int | bytes]) → None[source]

Deprecated since version 10.2.0.

PIL.IptcImagePlugin.getiptcinfo(im: ImageFile) → dict[tuple[int, int], bytes | list[bytes]] | None[source]

Get IPTC information from TIFF, JPEG, or IPTC file.

Parameters:

im – An image containing IPTC data.

Returns:

A dictionary containing IPTC information, or None if no IPTC information block was found.

PIL.IptcImagePlugin.i(c: bytes) → int[source]

Deprecated since version 10.2.0.

JpegImagePlugin module

PIL.JpegImagePlugin.APP(self: JpegImageFile, marker: int) → None[source]

PIL.JpegImagePlugin.COM(self: JpegImageFile, marker: int) → None[source]

PIL.JpegImagePlugin.DQT(self: JpegImageFile, marker: int) → None[source]

class PIL.JpegImagePlugin.JpegImageFile(fp: StrOrBytesPath | IO[bytes], filename: str | bytes | None = None)[source]

Bases: ImageFile

draft(mode: str | None, size: tuple[int, int] | None) → tuple[str, tuple[int, int, float, float]] | None[source]

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 andbox with coordinates of the original image within the altered one.

Note that this method modifies the 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.

Parameters:

format_: str | None_ = 'JPEG'

format_description_: str | None_ = 'JPEG (ISO 10918)'

load_djpeg() → None[source]

load_read(read_bytes: int) → bytes[source]

internal: read more image data For premature EOF and LOAD_TRUNCATED_IMAGES adds EOI marker so libjpeg can finish decoding

PIL.JpegImagePlugin.SOF(self: JpegImageFile, marker: int) → None[source]

PIL.JpegImagePlugin.Skip(self: JpegImageFile, marker: int) → None[source]

PIL.JpegImagePlugin.get_sampling(im: Image) → int[source]

PIL.JpegImagePlugin.jpeg_factory(fp: IO[bytes], filename: str | bytes | None = None) → JpegImageFile | MpoImageFile[source]

Jpeg2KImagePlugin module

class PIL.Jpeg2KImagePlugin.BoxReader(fp: IO[bytes], length: int = -1)[source]

Bases: object

A small helper class to read fields stored in JPEG2000 header boxes and to easily step into and read sub-boxes.

has_next_box() → bool[source]

next_box_type() → bytes[source]

read_boxes() → BoxReader[source]

read_fields(field_format: str) → tuple[int | bytes, ...][source]

class PIL.Jpeg2KImagePlugin.Jpeg2KImageFile(fp: StrOrBytesPath | IO[bytes], filename: str | bytes | None = None)[source]

Bases: ImageFile

format_: str | None_ = 'JPEG2000'

format_description_: str | None_ = 'JPEG 2000 (ISO 15444)'

load() → Image.core.PixelAccess | None[source]

Load image data based on tile list

property reduce_: Callable[[int | tuple[int, int], tuple[int, int, int, int] | None], Image] | int_

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.

Parameters:

McIdasImagePlugin module

class PIL.McIdasImagePlugin.McIdasImageFile(fp: StrOrBytesPath | IO[bytes], filename: str | bytes | None = None)[source]

Bases: ImageFile

format_: str | None_ = 'MCIDAS'

format_description_: str | None_ = 'McIdas area file'

MicImagePlugin module

class PIL.MicImagePlugin.MicImageFile(fp: str | bytes | PathLike[str] | PathLike[bytes] | IO[bytes], filename: str | bytes | None = None)[source]

Bases: TiffImageFile

close() → None[source]

Closes the file pointer, if possible.

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 theload() method. See File handling in Pillow for more information.

format_: str | None_ = 'MIC'

format_description_: str | None_ = 'Microsoft Image Composer'

seek(frame: int) → None[source]

Select a given frame as current image

tell() → int[source]

Return the current frame number

MpegImagePlugin module

class PIL.MpegImagePlugin.BitStream(fp: SupportsRead[bytes])[source]

Bases: object

next() → int[source]

peek(bits: int) → int[source]

read(bits: int) → int[source]

skip(bits: int) → None[source]

class PIL.MpegImagePlugin.MpegImageFile(fp: StrOrBytesPath | IO[bytes], filename: str | bytes | None = None)[source]

Bases: ImageFile

format_: str | None_ = 'MPEG'

format_description_: str | None_ = 'MPEG'

MpoImagePlugin module

class PIL.MpoImagePlugin.MpoImageFile(fp: StrOrBytesPath | IO[bytes], filename: str | bytes | None = None)[source]

Bases: JpegImageFile

static adopt(jpeg_instance: JpegImageFile, mpheader: dict[int, Any] | None = None) → MpoImageFile[source]

Transform the instance of JpegImageFile into an instance of MpoImageFile. After the call, the JpegImageFile is extended to be an MpoImageFile.

This is essentially useful when opening a JPEG file that reveals itself as an MPO, to avoid double call to _open.

format_: str | None_ = 'MPO'

format_description_: str | None_ = 'MPO (CIPA DC-007)'

load_seek(pos: int) → None[source]

seek(frame: int) → None[source]

Seeks to the given frame in this sequence file. If you seek beyond the end of the sequence, the method raises anEOFError exception. When a sequence file is opened, the library automatically seeks to frame 0.

See tell().

If defined, n_frames refers to the number of available frames.

Parameters:

frame – Frame number, starting at 0.

Raises:

EOFError – If the call attempts to seek beyond the end of the sequence.

tell() → int[source]

Returns the current frame number. See seek().

If defined, n_frames refers to the number of available frames.

Returns:

Frame number, starting with 0.

MspImagePlugin module

class PIL.MspImagePlugin.MspDecoder(mode: str, *args: Any)[source]

Bases: PyDecoder

decode(buffer: bytes | SupportsArrayInterface) → tuple[int, int][source]

Override to perform the decoding process.

Parameters:

buffer – A bytes object with the data to be decoded.

Returns:

A tuple of (bytes consumed, errcode). If finished with decoding return -1 for the bytes consumed. Err codes are from ImageFile.ERRORS.

class PIL.MspImagePlugin.MspImageFile(fp: StrOrBytesPath | IO[bytes], filename: str | bytes | None = None)[source]

Bases: ImageFile

format_: str | None_ = 'MSP'

format_description_: str | None_ = 'Windows Paint'

PalmImagePlugin module

PIL.PalmImagePlugin.build_prototype_image() → Image[source]

PcdImagePlugin module

class PIL.PcdImagePlugin.PcdImageFile(fp: StrOrBytesPath | IO[bytes], filename: str | bytes | None = None)[source]

Bases: ImageFile

format_: str | None_ = 'PCD'

format_description_: str | None_ = 'Kodak PhotoCD'

load_end() → None[source]

PcxImagePlugin module

class PIL.PcxImagePlugin.PcxImageFile(fp: StrOrBytesPath | IO[bytes], filename: str | bytes | None = None)[source]

Bases: ImageFile

format_: str | None_ = 'PCX'

format_description_: str | None_ = 'Paintbrush'

PdfImagePlugin module

PixarImagePlugin module

class PIL.PixarImagePlugin.PixarImageFile(fp: StrOrBytesPath | IO[bytes], filename: str | bytes | None = None)[source]

Bases: ImageFile

format_: str | None_ = 'PIXAR'

format_description_: str | None_ = 'PIXAR raster image'

PngImagePlugin module

class PIL.PngImagePlugin.Blend(*values)[source]

Bases: IntEnum

OP_OVER = 1

This frame should be alpha composited with the previous output image contents. See Saving APNG sequences.

OP_SOURCE = 0

All color components of this frame, including alpha, overwrite the previous output image contents. See Saving APNG sequences.

class PIL.PngImagePlugin.ChunkStream(fp: IO[bytes])[source]

Bases: object

call(cid: bytes, pos: int, length: int) → bytes[source]

Call the appropriate chunk handler

close() → None[source]

crc(cid: bytes, data: bytes) → None[source]

Read and verify checksum

crc_skip(cid: bytes, data: bytes) → None[source]

Read checksum

push(cid: bytes, pos: int, length: int) → None[source]

read() → tuple[bytes, int, int][source]

Fetch a new chunk. Returns header information.

verify(endchunk: bytes = b'IEND') → list[bytes][source]

class PIL.PngImagePlugin.Disposal(*values)[source]

Bases: IntEnum

OP_BACKGROUND = 1

This frame’s modified region is cleared to fully transparent black before rendering the next frame. See Saving APNG sequences.

OP_NONE = 0

No disposal is done on this frame before rendering the next frame. See Saving APNG sequences.

OP_PREVIOUS = 2

This frame’s modified region is reverted to the previous frame’s contents before rendering the next frame. See Saving APNG sequences.

class PIL.PngImagePlugin.PngImageFile(fp: StrOrBytesPath | IO[bytes], filename: str | bytes | None = None)[source]

Bases: ImageFile

getexif() → Exif[source]

Gets EXIF data from the image.

Returns:

an Exif object.

load_end() → None[source]

internal: finished reading image data

load_prepare() → None[source]

internal: prepare to read PNG file

load_read(read_bytes: int) → bytes[source]

internal: read more image data

seek(frame: int) → None[source]

Seeks to the given frame in this sequence file. If you seek beyond the end of the sequence, the method raises anEOFError exception. When a sequence file is opened, the library automatically seeks to frame 0.

See tell().

If defined, n_frames refers to the number of available frames.

Parameters:

frame – Frame number, starting at 0.

Raises:

EOFError – If the call attempts to seek beyond the end of the sequence.

tell() → int[source]

Returns the current frame number. See seek().

If defined, n_frames refers to the number of available frames.

Returns:

Frame number, starting with 0.

verify() → None[source]

Verify PNG file

format_: str | None_ = 'PNG'

format_description_: str | None_ = 'Portable network graphics'

property text_: dict[str, str | iTXt]_

class PIL.PngImagePlugin.PngStream(fp: IO[bytes])[source]

Bases: ChunkStream

check_text_memory(chunklen: int) → None[source]

chunk_IDAT(pos: int, length: int) → NoReturn[source]

chunk_IEND(pos: int, length: int) → NoReturn[source]

chunk_IHDR(pos: int, length: int) → bytes[source]

chunk_PLTE(pos: int, length: int) → bytes[source]

chunk_acTL(pos: int, length: int) → bytes[source]

chunk_cHRM(pos: int, length: int) → bytes[source]

chunk_eXIf(pos: int, length: int) → bytes[source]

chunk_fcTL(pos: int, length: int) → bytes[source]

chunk_fdAT(pos: int, length: int) → bytes[source]

chunk_gAMA(pos: int, length: int) → bytes[source]

chunk_iCCP(pos: int, length: int) → bytes[source]

chunk_iTXt(pos: int, length: int) → bytes[source]

chunk_pHYs(pos: int, length: int) → bytes[source]

chunk_sRGB(pos: int, length: int) → bytes[source]

chunk_tEXt(pos: int, length: int) → bytes[source]

chunk_tRNS(pos: int, length: int) → bytes[source]

chunk_zTXt(pos: int, length: int) → bytes[source]

rewind() → None[source]

save_rewind() → None[source]

PIL.PngImagePlugin.getchunks(im: Image, **params: Any) → list[tuple[bytes, bytes, bytes]][source]

Return a list of PNG chunks representing this image.

PIL.PngImagePlugin.is_cid(string, pos=0, endpos=9223372036854775807)

Matches zero or more characters at the beginning of the string.

PIL.PngImagePlugin.putchunk(fp: IO[bytes], cid: bytes, *data: bytes) → None[source]

Write a PNG chunk (including CRC field)

PIL.PngImagePlugin.MAX_TEXT_CHUNK = 1048576

Maximum decompressed size for a iTXt or zTXt chunk. Eliminates decompression bombs where compressed chunks can expand 1000x. See Text in PNG File Format.

PIL.PngImagePlugin.MAX_TEXT_MEMORY = 67108864

Set the maximum total text chunk size. See Text in PNG File Format.

PpmImagePlugin module

class PIL.PpmImagePlugin.PpmDecoder(mode: str, *args: Any)[source]

Bases: PyDecoder

decode(buffer: bytes | SupportsArrayInterface) → tuple[int, int][source]

Override to perform the decoding process.

Parameters:

buffer – A bytes object with the data to be decoded.

Returns:

A tuple of (bytes consumed, errcode). If finished with decoding return -1 for the bytes consumed. Err codes are from ImageFile.ERRORS.

class PIL.PpmImagePlugin.PpmImageFile(fp: StrOrBytesPath | IO[bytes], filename: str | bytes | None = None)[source]

Bases: ImageFile

format_: str | None_ = 'PPM'

format_description_: str | None_ = 'Pbmplus image'

class PIL.PpmImagePlugin.PpmPlainDecoder(mode: str, *args: Any)[source]

Bases: PyDecoder

decode(buffer: bytes | SupportsArrayInterface) → tuple[int, int][source]

Override to perform the decoding process.

Parameters:

buffer – A bytes object with the data to be decoded.

Returns:

A tuple of (bytes consumed, errcode). If finished with decoding return -1 for the bytes consumed. Err codes are from ImageFile.ERRORS.

PsdImagePlugin module

class PIL.PsdImagePlugin.PsdImageFile(fp: StrOrBytesPath | IO[bytes], filename: str | bytes | None = None)[source]

Bases: ImageFile

format_: str | None_ = 'PSD'

format_description_: str | None_ = 'Adobe Photoshop'

property is_animated_: bool_

property layers_: list[tuple[str, str, tuple[int, int, int, int], list[_Tile]]]_[source]

property n_frames_: int_

seek(layer: int) → None[source]

Seeks to the given frame in this sequence file. If you seek beyond the end of the sequence, the method raises anEOFError exception. When a sequence file is opened, the library automatically seeks to frame 0.

See tell().

If defined, n_frames refers to the number of available frames.

Parameters:

frame – Frame number, starting at 0.

Raises:

EOFError – If the call attempts to seek beyond the end of the sequence.

tell() → int[source]

Returns the current frame number. See seek().

If defined, n_frames refers to the number of available frames.

Returns:

Frame number, starting with 0.

SgiImagePlugin module

class PIL.SgiImagePlugin.SGI16Decoder(mode: str, *args: Any)[source]

Bases: PyDecoder

decode(buffer: bytes | SupportsArrayInterface) → tuple[int, int][source]

Override to perform the decoding process.

Parameters:

buffer – A bytes object with the data to be decoded.

Returns:

A tuple of (bytes consumed, errcode). If finished with decoding return -1 for the bytes consumed. Err codes are from ImageFile.ERRORS.

class PIL.SgiImagePlugin.SgiImageFile(fp: StrOrBytesPath | IO[bytes], filename: str | bytes | None = None)[source]

Bases: ImageFile

format_: str | None_ = 'SGI'

format_description_: str | None_ = 'SGI Image File Format'

SpiderImagePlugin module

class PIL.SpiderImagePlugin.SpiderImageFile(fp: StrOrBytesPath | IO[bytes], filename: str | bytes | None = None)[source]

Bases: ImageFile

convert2byte(depth: int = 255) → Image[source]

format_: str | None_ = 'SPIDER'

format_description_: str | None_ = 'Spider 2D image'

property is_animated_: bool_

property n_frames_: int_

seek(frame: int) → None[source]

Seeks to the given frame in this sequence file. If you seek beyond the end of the sequence, the method raises anEOFError exception. When a sequence file is opened, the library automatically seeks to frame 0.

See tell().

If defined, n_frames refers to the number of available frames.

Parameters:

frame – Frame number, starting at 0.

Raises:

EOFError – If the call attempts to seek beyond the end of the sequence.

tell() → int[source]

Returns the current frame number. See seek().

If defined, n_frames refers to the number of available frames.

Returns:

Frame number, starting with 0.

tkPhotoImage() → ImageTk.PhotoImage[source]

PIL.SpiderImagePlugin.isInt(f: Any) → int[source]

PIL.SpiderImagePlugin.isSpiderImage(filename: str) → int[source]

PIL.SpiderImagePlugin.loadImageSeries(filelist: list[str] | None = None) → list[Image] | None[source]

create a list of Image objects for use in a montage

SunImagePlugin module

class PIL.SunImagePlugin.SunImageFile(fp: StrOrBytesPath | IO[bytes], filename: str | bytes | None = None)[source]

Bases: ImageFile

format_: str | None_ = 'SUN'

format_description_: str | None_ = 'Sun Raster File'

TgaImagePlugin module

class PIL.TgaImagePlugin.TgaImageFile(fp: StrOrBytesPath | IO[bytes], filename: str | bytes | None = None)[source]

Bases: ImageFile

format_: str | None_ = 'TGA'

format_description_: str | None_ = 'Targa'

load_end() → None[source]

TiffImagePlugin module

class PIL.TiffImagePlugin.AppendingTiffWriter(fn: str | bytes | PathLike[str] | PathLike[bytes] | IO[bytes], new: bool = False)[source]

Bases: BytesIO

Tags = {273, 288, 324, 519, 520, 521}

close() → None[source]

Disable all I/O operations.

fieldSizes = [0, 1, 1, 2, 4, 8, 1, 1, 2, 4, 8, 4, 8, 4, 2, 4, 8]

finalize() → None[source]

fixIFD() → None[source]

fixOffsets(count: int, isShort: bool = False, isLong: bool = False) → None[source]

goToEnd() → None[source]

newFrame() → None[source]

readLong() → int[source]

readShort() → int[source]

rewriteLastLong(value: int) → None[source]

rewriteLastShort(value: int) → None[source]

rewriteLastShortToLong(value: int) → None[source]

seek(offset: int, whence: int = 0) → int[source]

Parameters:

Returns:

The resulting position, relative to the start.

setEndian(endian: str) → None[source]

setup() → None[source]

skipIFDs() → None[source]

tell() → int[source]

Current file position, an integer.

write(data: Buffer, /) → int[source]

Write bytes to file.

Return the number of bytes written.

writeLong(value: int) → None[source]

writeShort(value: int) → None[source]

class PIL.TiffImagePlugin.IFDRational(value: float | Fraction | IFDRational, denominator: int = 1)[source]

Bases: Rational

Implements a rational class where 0/0 is a legal value to match the in the wild use of exif rationals.

e.g., DigitalZoomRatio - 0.00/0.00 indicates that no digital zoom was used

property denominator_: int_

limit_rational(max_denominator: int) → tuple[IntegralLike, int][source]

Parameters:

max_denominator – Integer, the maximum denominator value

Returns:

Tuple of (numerator, denominator)

property numerator_: IntegralLike_

PIL.TiffImagePlugin.ImageFileDirectory

alias of ImageFileDirectory_v1

class PIL.TiffImagePlugin.ImageFileDirectory_v1(*args: Any, **kwargs: Any)[source]

Bases: ImageFileDirectory_v2

This class represents the legacy interface to a TIFF tag directory.

Exposes a dictionary interface of the tags in the directory:

ifd = ImageFileDirectory_v1() ifd[key] = 'Some Data' ifd.tagtype[key] = TiffTags.ASCII print(ifd[key]) ('Some Data',)

Also contains a dictionary of tag types as read from the tiff image file,tagtype.

Values are returned as a tuple.

Deprecated since version 3.0.0.

classmethod from_v2(original: ImageFileDirectory_v2) → ImageFileDirectory_v1[source]

Returns anImageFileDirectory_v1instance with the same data as is contained in the originalImageFileDirectory_v2instance.

Returns:

ImageFileDirectory_v1

property tagdata

property tags

tagtype_: dict[int, int]_

Dictionary of tag types

to_v2() → ImageFileDirectory_v2[source]

Returns anImageFileDirectory_v2instance with the same data as is contained in the originalImageFileDirectory_v1instance.

Returns:

ImageFileDirectory_v2

class PIL.TiffImagePlugin.ImageFileDirectory_v2(ifh: bytes = b'II*\x00\x00\x00\x00\x00', prefix: bytes | None = None, group: int | None = None)[source]

Bases: MutableMapping

This class represents a TIFF tag directory. To speed things up, we don’t decode tags unless they’re asked for.

Exposes a dictionary interface of the tags in the directory:

ifd = ImageFileDirectory_v2() ifd[key] = 'Some Data' ifd.tagtype[key] = TiffTags.ASCII print(ifd[key]) 'Some Data'

Individual values are returned as the strings or numbers, sequences are returned as tuples of the values.

The tiff metadata type of each item is stored in a dictionary of tag types intagtype. The types are read from a tiff file, guessed from the type added, or added manually.

Data Structures:

‘Internal’ data structures:

Tags will be found in the private attributes self._tagdata, and inself._tags_v2 once decoded.

self.legacy_api is a value for internal use, and shouldn’t be changed from outside code. In cooperation withImageFileDirectory_v1, if legacy_apiis true, then decoded tags will be populated into both _tags_v1 and_tags_v2. _tags_v2 will be used if this IFD is used in the TIFF save routine. Tags should be read from _tags_v1 iflegacy_api == true.

property legacy_api_: bool_

load(fp: IO[bytes]) → None[source]

load_byte(data: bytes, legacy_api: bool = True) → bytes[source]

load_double(data: bytes, legacy_api: bool = True) → tuple[Any, ...]

load_float(data: bytes, legacy_api: bool = True) → tuple[Any, ...]

load_long(data: bytes, legacy_api: bool = True) → tuple[Any, ...]

load_long8(data: bytes, legacy_api: bool = True) → tuple[Any, ...]

load_rational(data: bytes, legacy_api: bool = True) → tuple[tuple[int, int] | IFDRational, ...][source]

load_short(data: bytes, legacy_api: bool = True) → tuple[Any, ...]

load_signed_byte(data: bytes, legacy_api: bool = True) → tuple[Any, ...]

load_signed_long(data: bytes, legacy_api: bool = True) → tuple[Any, ...]

load_signed_rational(data: bytes, legacy_api: bool = True) → tuple[tuple[int, int] | IFDRational, ...][source]

load_signed_short(data: bytes, legacy_api: bool = True) → tuple[Any, ...]

load_string(data: bytes, legacy_api: bool = True) → str[source]

load_undefined(data: bytes, legacy_api: bool = True) → bytes[source]

named() → dict[str, Any][source]

Returns:

dict of name|key: value

Returns the complete tag dictionary, with named tags where possible.

property offset

property prefix

reset() → None[source]

save(fp: IO[bytes]) → int[source]

tagtype_: dict[int, int]_

Dictionary of tag types

tobytes(offset: int = 0) → bytes[source]

write_byte(data: bytes | int | IFDRational) → bytes[source]

write_double(*values)

write_float(*values)

write_long(*values)

write_long8(*values)

write_rational(*values: IFDRational) → bytes[source]

write_short(*values)

write_signed_byte(*values)

write_signed_long(*values)

write_signed_rational(*values: IFDRational) → bytes[source]

write_signed_short(*values)

write_string(value: str | bytes | int) → bytes[source]

write_undefined(value: bytes | int | IFDRational) → bytes[source]

class PIL.TiffImagePlugin.TiffImageFile(fp: str | bytes | PathLike[str] | PathLike[bytes] | IO[bytes], filename: str | bytes | None = None)[source]

Bases: ImageFile

format_: str | None_ = 'TIFF'

format_description_: str | None_ = 'Adobe TIFF'

get_photoshop_blocks() → dict[int, dict[str, bytes]][source]

Returns a dictionary of Photoshop “Image Resource Blocks”. The keys are the image resource ID. For more information, seehttps://www.adobe.com/devnet-apps/photoshop/fileformatashtml/#50577409_pgfId-1037727

Returns:

Photoshop “Image Resource Blocks” in a dictionary.

load() → Image.core.PixelAccess | None[source]

Load image data based on tile list

load_end() → None[source]

load_prepare() → None[source]

property n_frames_: int_

seek(frame: int) → None[source]

Select a given frame as current image

tag_: ImageFileDirectory_v1_

Legacy tag entries

tag_v2_: ImageFileDirectory_v2_

Image file directory (tag dictionary)

tell() → int[source]

Return the current frame number

WebPImagePlugin module

class PIL.WebPImagePlugin.WebPImageFile(fp: StrOrBytesPath | IO[bytes], filename: str | bytes | None = None)[source]

Bases: ImageFile

format_: str | None_ = 'WEBP'

format_description_: str | None_ = 'WebP image'

load() → Image.core.PixelAccess | None[source]

Load image data based on tile list

load_seek(pos: int) → None[source]

seek(frame: int) → None[source]

Seeks to the given frame in this sequence file. If you seek beyond the end of the sequence, the method raises anEOFError exception. When a sequence file is opened, the library automatically seeks to frame 0.

See tell().

If defined, n_frames refers to the number of available frames.

Parameters:

frame – Frame number, starting at 0.

Raises:

EOFError – If the call attempts to seek beyond the end of the sequence.

tell() → int[source]

Returns the current frame number. See seek().

If defined, n_frames refers to the number of available frames.

Returns:

Frame number, starting with 0.

WmfImagePlugin module

class PIL.WmfImagePlugin.WmfStubImageFile(fp: StrOrBytesPath | IO[bytes], filename: str | bytes | None = None)[source]

Bases: StubImageFile

format_: str | None_ = 'WMF'

format_description_: str | None_ = 'Windows Metafile'

load(dpi: float | tuple[float, float] | None = None) → Image.core.PixelAccess | None[source]

Load image data based on tile list

PIL.WmfImagePlugin.register_handler(handler: StubHandler | None) → None[source]

Install application-specific WMF image handler.

Parameters:

handler – Handler object.

XVThumbImagePlugin module

class PIL.XVThumbImagePlugin.XVThumbImageFile(fp: StrOrBytesPath | IO[bytes], filename: str | bytes | None = None)[source]

Bases: ImageFile

format_: str | None_ = 'XVThumb'

format_description_: str | None_ = 'XV thumbnail image'

XbmImagePlugin module

class PIL.XbmImagePlugin.XbmImageFile(fp: StrOrBytesPath | IO[bytes], filename: str | bytes | None = None)[source]

Bases: ImageFile

format_: str | None_ = 'XBM'

format_description_: str | None_ = 'X11 Bitmap'

XpmImagePlugin module

class PIL.XpmImagePlugin.XpmImageFile(fp: StrOrBytesPath | IO[bytes], filename: str | bytes | None = None)[source]

Bases: ImageFile

format_: str | None_ = 'XPM'

format_description_: str | None_ = 'X11 Pixel Map'

load_read(read_bytes: int) → bytes[source]