PIL Package (autodoc of remaining modules)#

Reference for modules whose documentation has not yet been ported or written can be found here.

PIL Module#

exception PIL.UnidentifiedImageError[source]#

Bases: OSError

Raised in PIL.Image.open() if an image cannot be opened and identified.

If a PNG image raises this error, setting ImageFile.LOAD_TRUNCATED_IMAGES to true may allow the image to be opened after all. The setting will ignore missing data and checksum failures.

BdfFontFile Module#

ContainerIO Module#

class PIL.ContainerIO.ContainerIO(file: IO, offset: int, length: int)[source]#

Bases: Generic

A file object that provides read access to a part of an existing file (for example a TAR file).

isatty() bool[source]#
read(n: int = 0) AnyStr[source]#

Read data.

Parameters:

n – Number of bytes to read. If omitted or zero, read until end of region.

Returns:

An 8-bit string.

readline() AnyStr[source]#

Read a line of text.

Returns:

An 8-bit string.

readlines() list[AnyStr][source]#

Read multiple lines of text.

Returns:

A list of 8-bit strings.

seek(offset: int, mode: Literal[0, 1, 2] = 0) None[source]#

Move file pointer.

Parameters:
  • offset – Offset in bytes.

  • mode – Starting position. Use 0 for beginning of region, 1 for current offset, and 2 for end of region. You cannot move the pointer outside the defined region.

tell() int[source]#

Get current file pointer.

Returns:

Offset from start of region, in bytes.

FontFile Module#

GdImageFile Module#

GimpGradientFile Module#

Stuff to translate curve segments to palette values (derived from the corresponding code in GIMP, written by Federico Mena Quintero. See the GIMP distribution for more information.)

PIL.GimpGradientFile.EPSILON = 1e-10#
class PIL.GimpGradientFile.GimpGradientFile(fp)[source]#

Bases: GradientFile

File handler for GIMP’s gradient format.

class PIL.GimpGradientFile.GradientFile[source]#

Bases: object

getpalette(entries=256)[source]#
gradient = None#
PIL.GimpGradientFile.SEGMENTS = [<function linear>, <function curved>, <function sine>, <function sphere_increasing>, <function sphere_decreasing>]#
PIL.GimpGradientFile.curved(middle, pos)[source]#
PIL.GimpGradientFile.linear(middle, pos)[source]#
PIL.GimpGradientFile.sine(middle, pos)[source]#
PIL.GimpGradientFile.sphere_decreasing(middle, pos)[source]#
PIL.GimpGradientFile.sphere_increasing(middle, pos)[source]#

GimpPaletteFile Module#

class PIL.GimpPaletteFile.GimpPaletteFile(fp)[source]#

Bases: object

File handler for GIMP’s palette format.

getpalette()[source]#
rawmode = 'RGB'#

ImageDraw2 Module#

ImageMode Module#

class PIL.ImageMode.ModeDescriptor(mode: str, bands: tuple[str, ...], basemode: str, basetype: str, typestr: str)[source]#

Bases: object

Wrapper for mode strings.

PIL.ImageMode.getmode(mode: str) ModeDescriptor[source]#

Gets a mode descriptor for the given mode.

ImageTransform Module#

PaletteFile Module#

class PIL.PaletteFile.PaletteFile(fp)[source]#

Bases: object

File handler for Teragon-style palette files.

getpalette()[source]#
rawmode = 'RGB'#

PcfFontFile Module#

PngImagePlugin.iTXt Class#

PngImagePlugin.PngInfo Class#

TarIO Module#

class PIL.TarIO.TarIO(tarfile: str, file: str)[source]#

Bases: ContainerIO[bytes]

A file object that provides read access to a given member of a TAR file.

close() None[source]#

WalImageFile Module#