# Plugin reference

## `BmpImagePlugin` Module

class PIL.BmpImagePlugin.BmpImageFile(fp=None, filename=None)

  Bases: `PIL.ImageFile.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 = 'BMP'
  format_description = 'Windows Bitmap'
  k = 'PNG'
  v = 5

class PIL.BmpImagePlugin.DibImageFile(fp=None, filename=None)

  Bases: `PIL.BmpImagePlugin.BmpImageFile`

  format = 'DIB'
  format_description = 'Windows Bitmap'

## `BufrStubImagePlugin` Module

class PIL.BufrStubImagePlugin.BufrStubImageFile(fp=None, filename=None)

  Bases: `PIL.ImageFile.StubImageFile`

  format = 'BUFR'
  format_description = 'BUFR'

PIL.BufrStubImagePlugin.register_handler(handler)

  Install application-specific BUFR image handler.

  Parameters

    handler – Handler object.

## `CurImagePlugin` Module

class PIL.CurImagePlugin.CurImageFile(fp=None, filename=None)

  Bases: `PIL.BmpImagePlugin.BmpImageFile`

  format = 'CUR'
  format_description = 'Windows Cursor'

## `DcxImagePlugin` Module

class PIL.DcxImagePlugin.DcxImageFile(fp=None, filename=None)

  Bases: `PIL.PcxImagePlugin.PcxImageFile`

  format = 'DCX'
  format_description = 'Intel DCX'
  seek(frame)

    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 `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()

    Returns the current frame number. See `seek()`.

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

    Returns

      Frame number, starting with 0.

## `EpsImagePlugin` Module

class PIL.EpsImagePlugin.EpsImageFile(fp=None, filename=None)

  Bases: `PIL.ImageFile.ImageFile`

  EPS File Parser for the Python Imaging Library

  format = 'EPS'
  format_description = 'Encapsulated Postscript'
  load(scale=1, transparency=False)

    Load image data based on tile list

  load_seek(*args, **kwargs)
  mode_map = {1: 'L', 2: 'LAB', 3: 'RGB', 4: 'CMYK'}

PIL.EpsImagePlugin.Ghostscript(tile, size, fp, scale=1, transparency=False)

  Render an image using Ghostscript

class PIL.EpsImagePlugin.PSFile(fp)

  Bases: `object`

  Wrapper for bytesio object that treats either CR or LF as end of line.

  readline()
  seek(offset, whence=0)

PIL.EpsImagePlugin.has_ghostscript()

## `FitsStubImagePlugin` Module

class PIL.FitsStubImagePlugin.FITSStubImageFile(fp=None, filename=None)

  Bases: `PIL.ImageFile.StubImageFile`

  format = 'FITS'
  format_description = 'FITS'

PIL.FitsStubImagePlugin.register_handler(handler)

  Install application-specific FITS image handler.

  Parameters

    handler – Handler object.

## `FliImagePlugin` Module

class PIL.FliImagePlugin.FliImageFile(fp=None, filename=None)

  Bases: `PIL.ImageFile.ImageFile`

  format = 'FLI'
  format_description = 'Autodesk FLI/FLC Animation'
  seek(frame)

    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 `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()

    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=None, filename=None)

  Bases: `PIL.ImageFile.ImageFile`

  format = 'FPX'
  format_description = 'FlashPix'
  load()

    Load image data based on tile list

## `GbrImagePlugin` Module

class PIL.GbrImagePlugin.GbrImageFile(fp=None, filename=None)

  Bases: `PIL.ImageFile.ImageFile`

  format = 'GBR'
  format_description = 'GIMP brush file'
  load()

    Load image data based on tile list

## `GifImagePlugin` Module

class PIL.GifImagePlugin.GifImageFile(fp=None, filename=None)

  Bases: `PIL.ImageFile.ImageFile`

  data()
  format = 'GIF'
  format_description = 'Compuserve GIF'
  global_palette = None
  property is_animated
  load_end()
  load_prepare()
  property n_frames
  seek(frame)

    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 `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()

    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.get_interlace(im)

PIL.GifImagePlugin.getdata(im, offset=(0, 0), **params)

  Legacy Method

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

  Parameters

    - im – Image object

    - offset – Tuple of (x, y) pixels. Defaults to (0,0)

    - **params – E.g. duration or other encoder info parameters

  Returns

    List of Bytes containing gif encoded frame data

PIL.GifImagePlugin.getheader(im, palette=None, info=None)

  Legacy Method to get Gif data from image.

  Warning:: May modify image data.

  Parameters

    - im – Image object

    - palette – bytes object containing the source palette, or ….

    - info – encoderinfo

  Returns

    tuple of(list of header items, optimized palette)

## `GribStubImagePlugin` Module

class PIL.GribStubImagePlugin.GribStubImageFile(fp=None, filename=None)

  Bases: `PIL.ImageFile.StubImageFile`

  format = 'GRIB'
  format_description = 'GRIB'

PIL.GribStubImagePlugin.register_handler(handler)

  Install application-specific GRIB image handler.

  Parameters

    handler – Handler object.

## `Hdf5StubImagePlugin` Module

class PIL.Hdf5StubImagePlugin.HDF5StubImageFile(fp=None, filename=None)

  Bases: `PIL.ImageFile.StubImageFile`

  format = 'HDF5'
  format_description = 'HDF5'

PIL.Hdf5StubImagePlugin.register_handler(handler)

  Install application-specific HDF5 image handler.

  Parameters

    handler – Handler object.

## `IcnsImagePlugin` Module

class PIL.IcnsImagePlugin.IcnsFile(fobj)

  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()
  dataforsize(size)

    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=None)
  itersizes()

class PIL.IcnsImagePlugin.IcnsImageFile(fp=None, filename=None)

  Bases: `PIL.ImageFile.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 = 'ICNS'
  format_description = 'Mac OS icns resource'
  load()

    Load image data based on tile list

  property size

PIL.IcnsImagePlugin.nextheader(fobj)

PIL.IcnsImagePlugin.read_32(fobj, start_length, size)

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

PIL.IcnsImagePlugin.read_32t(fobj, start_length, size)

PIL.IcnsImagePlugin.read_mk(fobj, start_length, size)

PIL.IcnsImagePlugin.read_png_or_jpeg2000(fobj, start_length, size)

## `IcoImagePlugin` Module

class PIL.IcoImagePlugin.IcoFile(buf)

  Bases: `object`

  frame(idx)

    Get an image from frame idx

  getentryindex(size, bpp=False)
  getimage(size, bpp=False)

    Get an image from the icon

  sizes()

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

class PIL.IcoImagePlugin.IcoImageFile(fp=None, filename=None)

  Bases: `PIL.ImageFile.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 = 'ICO'
  format_description = 'Windows Icon'
  load()

    Load image data based on tile list

  load_seek()
  property size

## `ImImagePlugin` Module

class PIL.ImImagePlugin.ImImageFile(fp=None, filename=None)

  Bases: `PIL.ImageFile.ImageFile`

  format = 'IM'
  format_description = 'IFUNC Image Memory'
  property is_animated
  property n_frames
  seek(frame)

    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 `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()

    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)

## `ImtImagePlugin` Module

class PIL.ImtImagePlugin.ImtImageFile(fp=None, filename=None)

  Bases: `PIL.ImageFile.ImageFile`

  format = 'IMT'
  format_description = 'IM Tools'

## `IptcImagePlugin` Module

class PIL.IptcImagePlugin.IptcImageFile(fp=None, filename=None)

  Bases: `PIL.ImageFile.ImageFile`

  field()
  format = 'IPTC'
  format_description = 'IPTC/NAA'
  getint(key)
  load()

    Load image data based on tile list

PIL.IptcImagePlugin.dump(c)

PIL.IptcImagePlugin.getiptcinfo(im)

  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)

## `JpegImagePlugin` Module

PIL.JpegImagePlugin.APP(self, marker)

PIL.JpegImagePlugin.COM(self, marker)

PIL.JpegImagePlugin.DQT(self, marker)

class PIL.JpegImagePlugin.JpegImageFile(fp=None, filename=None)

  Bases: `PIL.ImageFile.ImageFile`

  draft(mode, size)

    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 greyscale 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 `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

      - mode – The requested mode.

      - size – The requested size.

  format = 'JPEG'
  format_description = 'JPEG (ISO 10918)'
  getxmp()

    Returns a dictionary containing the XMP tags. Requires defusedxml to be installed. :returns: XMP tags in a dictionary.

  load_djpeg()
  load_read(read_bytes)

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

PIL.JpegImagePlugin.SOF(self, marker)

PIL.JpegImagePlugin.Skip(self, marker)

PIL.JpegImagePlugin.convert_dict_qtables(qtables)

PIL.JpegImagePlugin.get_sampling(im)

PIL.JpegImagePlugin.jpeg_factory(fp=None, filename=None)

## `Jpeg2KImagePlugin` Module

class PIL.Jpeg2KImagePlugin.BoxReader(fp, length=- 1)

  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()
  next_box_type()
  read_boxes()
  read_fields(field_format)

class PIL.Jpeg2KImagePlugin.Jpeg2KImageFile(fp=None, filename=None)

  Bases: `PIL.ImageFile.ImageFile`

  format = 'JPEG2000'
  format_description = 'JPEG 2000 (ISO 15444)'
  load()

    Load image data based on tile list

  property reduce

    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

      - factor – A greater than 0 integer or tuple of two integers for width and height separately.

      - 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.

## `McIdasImagePlugin` Module

class PIL.McIdasImagePlugin.McIdasImageFile(fp=None, filename=None)

  Bases: `PIL.ImageFile.ImageFile`

  format = 'MCIDAS'
  format_description = 'McIdas area file'

## `MicImagePlugin` Module

class PIL.MicImagePlugin.MicImageFile(fp=None, filename=None)

  Bases: `PIL.TiffImagePlugin.TiffImageFile`

  format = 'MIC'
  format_description = 'Microsoft Image Composer'
  seek(frame)

    Select a given frame as current image

  tell()

    Return the current frame number

## `MpegImagePlugin` Module

class PIL.MpegImagePlugin.BitStream(fp)

  Bases: `object`

  next()
  peek(bits)
  read(bits)
  skip(bits)

class PIL.MpegImagePlugin.MpegImageFile(fp=None, filename=None)

  Bases: `PIL.ImageFile.ImageFile`

  format = 'MPEG'
  format_description = 'MPEG'

## `MspImagePlugin` Module

class PIL.MspImagePlugin.MspDecoder(mode, *args)

  Bases: `PIL.ImageFile.PyDecoder`

  decode(buffer)

    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 <0 for the bytes consumed. Err codes are from `ImageFile.ERRORS`.

class PIL.MspImagePlugin.MspImageFile(fp=None, filename=None)

  Bases: `PIL.ImageFile.ImageFile`

  format = 'MSP'
  format_description = 'Windows Paint'

## `PalmImagePlugin` Module

PIL.PalmImagePlugin.build_prototype_image()

## `PcdImagePlugin` Module

class PIL.PcdImagePlugin.PcdImageFile(fp=None, filename=None)

  Bases: `PIL.ImageFile.ImageFile`

  format = 'PCD'
  format_description = 'Kodak PhotoCD'
  load_end()

## `PcxImagePlugin` Module

class PIL.PcxImagePlugin.PcxImageFile(fp=None, filename=None)

  Bases: `PIL.ImageFile.ImageFile`

  format = 'PCX'
  format_description = 'Paintbrush'

## `PdfImagePlugin` Module

## `PixarImagePlugin` Module

class PIL.PixarImagePlugin.PixarImageFile(fp=None, filename=None)

  Bases: `PIL.ImageFile.ImageFile`

  format = 'PIXAR'
  format_description = 'PIXAR raster image'

## `PngImagePlugin` Module

class PIL.PngImagePlugin.ChunkStream(fp)

  Bases: `object`

  call(cid, pos, length)

    Call the appropriate chunk handler

  close()
  crc(cid, data)

    Read and verify checksum

  crc_skip(cid, data)

    Read checksum. Used if the C module is not present

  push(cid, pos, length)
  read()

    Fetch a new chunk. Returns header information.

  verify(endchunk=b'IEND')

class PIL.PngImagePlugin.PngImageFile(fp=None, filename=None)

  Bases: `PIL.ImageFile.ImageFile`

  getexif()
  getxmp()

    Returns a dictionary containing the XMP tags. Requires defusedxml to be installed. :returns: XMP tags in a dictionary.

  load_end()

    internal: finished reading image data

  load_prepare()

    internal: prepare to read PNG file

  load_read(read_bytes)

    internal: read more image data

  seek(frame)

    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 `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()

    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()

    Verify PNG file

  format = 'PNG'
  format_description = 'Portable network graphics'
  property text

class PIL.PngImagePlugin.PngStream(fp)

  Bases: `PIL.PngImagePlugin.ChunkStream`

  check_text_memory(chunklen)
  chunk_IDAT(pos, length)
  chunk_IEND(pos, length)
  chunk_IHDR(pos, length)
  chunk_PLTE(pos, length)
  chunk_acTL(pos, length)
  chunk_cHRM(pos, length)
  chunk_eXIf(pos, length)
  chunk_fcTL(pos, length)
  chunk_fdAT(pos, length)
  chunk_gAMA(pos, length)
  chunk_iCCP(pos, length)
  chunk_iTXt(pos, length)
  chunk_pHYs(pos, length)
  chunk_sRGB(pos, length)
  chunk_tEXt(pos, length)
  chunk_tRNS(pos, length)
  chunk_zTXt(pos, length)
  rewind()
  save_rewind()

PIL.PngImagePlugin.getchunks(im, **params)

  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, cid, *data)

  Write a PNG chunk (including CRC field)

PIL.PngImagePlugin.APNG_BLEND_OP_OVER = 1

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

PIL.PngImagePlugin.APNG_BLEND_OP_SOURCE = 0

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

PIL.PngImagePlugin.APNG_DISPOSE_OP_BACKGROUND = 1

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

PIL.PngImagePlugin.APNG_DISPOSE_OP_NONE = 0

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

PIL.PngImagePlugin.APNG_DISPOSE_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.

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.PpmImageFile(fp=None, filename=None)

  Bases: `PIL.ImageFile.ImageFile`

  format = 'PPM'
  format_description = 'Pbmplus image'

## `PsdImagePlugin` Module

class PIL.PsdImagePlugin.PsdImageFile(fp=None, filename=None)

  Bases: `PIL.ImageFile.ImageFile`

  format = 'PSD'
  format_description = 'Adobe Photoshop'
  load_prepare()
  seek(layer)

    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 `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()

    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, *args)

  Bases: `PIL.ImageFile.PyDecoder`

  decode(buffer)

    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 <0 for the bytes consumed. Err codes are from `ImageFile.ERRORS`.

class PIL.SgiImagePlugin.SgiImageFile(fp=None, filename=None)

  Bases: `PIL.ImageFile.ImageFile`

  format = 'SGI'
  format_description = 'SGI Image File Format'

## `SpiderImagePlugin` Module

class PIL.SpiderImagePlugin.SpiderImageFile(fp=None, filename=None)

  Bases: `PIL.ImageFile.ImageFile`

  convert2byte(depth=255)
  format = 'SPIDER'
  format_description = 'Spider 2D image'
  property is_animated
  property n_frames
  seek(frame)

    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 `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()

    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()

PIL.SpiderImagePlugin.isInt(f)

PIL.SpiderImagePlugin.isSpiderHeader(t)

PIL.SpiderImagePlugin.isSpiderImage(filename)

PIL.SpiderImagePlugin.loadImageSeries(filelist=None)

  create a list of `Image` objects for use in a montage

PIL.SpiderImagePlugin.makeSpiderHeader(im)

## `SunImagePlugin` Module

class PIL.SunImagePlugin.SunImageFile(fp=None, filename=None)

  Bases: `PIL.ImageFile.ImageFile`

  format = 'SUN'
  format_description = 'Sun Raster File'

## `TgaImagePlugin` Module

class PIL.TgaImagePlugin.TgaImageFile(fp=None, filename=None)

  Bases: `PIL.ImageFile.ImageFile`

  format = 'TGA'
  format_description = 'Targa'
  load_end()

## `TiffImagePlugin` Module

class PIL.TiffImagePlugin.AppendingTiffWriter(fn, new=False)

  Bases: `object`

  Tags = {273, 288, 324, 519, 520, 521}
  close()
  fieldSizes = [0, 1, 1, 2, 4, 8, 1, 1, 2, 4, 8, 4, 8]
  finalize()
  fixIFD()
  fixOffsets(count, isShort=False, isLong=False)
  goToEnd()
  newFrame()
  readLong()
  readShort()
  rewriteLastLong(value)
  rewriteLastShort(value)
  rewriteLastShortToLong(value)
  seek(offset, whence=0)
  setEndian(endian)
  setup()
  skipIFDs()
  tell()
  write(data)
  writeLong(value)
  writeShort(value)

class PIL.TiffImagePlugin.IFDRational(value, denominator=1)

  Bases: `numbers.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
  limit_rational(max_denominator)
    Parameters

      max_denominator – Integer, the maximum denominator value

    Returns

      Tuple of (numerator, denominator)

  property numerator

PIL.TiffImagePlugin.ImageFileDirectory

  alias of `PIL.TiffImagePlugin.ImageFileDirectory_v1`

class PIL.TiffImagePlugin.ImageFileDirectory_v1(*args, **kwargs)

  Bases: `PIL.TiffImagePlugin.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)

    Returns an `ImageFileDirectory_v1` instance with the same data as is contained in the original `ImageFileDirectory_v2` instance.

    Returns

      `ImageFileDirectory_v1`

  property tagdata
  property tags
  tagtype: dict

    Dictionary of tag types

  to_v2()

    Returns an `ImageFileDirectory_v2` instance with the same data as is contained in the original `ImageFileDirectory_v1` instance.

    Returns

      `ImageFileDirectory_v2`

class PIL.TiffImagePlugin.ImageFileDirectory_v2(ifh=b'II*\x00\x00\x00\x00\x00', prefix=None, group=None)

  Bases: `collections.abc.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 in `tagtype`. The types are read from a tiff file, guessed from the type added, or added manually.

  Data Structures:

  > - `self.tagtype = {}`

  >   - Key: numerical TIFF tag number

  >   - Value: integer corresponding to the data type from `TiffTags.TYPES`

  >   New in version 3.0.0.

  ‘Internal’ data structures:

  > - `self._tags_v2 = {}`

  >   - Key: numerical TIFF tag number

  >   - Value: decoded data, as tuple for multiple values

  > - `self._tagdata = {}`

  >   - Key: numerical TIFF tag number

  >   - Value: undecoded byte string from file

  > - `self._tags_v1 = {}`

  >   - Key: numerical TIFF tag number

  >   - Value: decoded data in the v1 format

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

  `self.legacy_api` is a value for internal use, and shouldn’t be changed from outside code. In cooperation with `ImageFileDirectory_v1`, if `legacy_api` is 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` if `legacy_api == true`.

  property legacy_api
  load(fp)
  load_byte(data, legacy_api=True)
  load_double(data, legacy_api=True)
  load_float(data, legacy_api=True)
  load_long(data, legacy_api=True)
  load_rational(data, legacy_api=True)
  load_short(data, legacy_api=True)
  load_signed_byte(data, legacy_api=True)
  load_signed_long(data, legacy_api=True)
  load_signed_rational(data, legacy_api=True)
  load_signed_short(data, legacy_api=True)
  load_string(data, legacy_api=True)
  load_undefined(data, legacy_api=True)
  named()
    Returns

      dict of name|key: value

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

  property offset
  property prefix
  reset()
  save(fp)
  tagtype

    Dictionary of tag types

  tobytes(offset=0)
  write_byte(data)
  write_double(*values)
  write_float(*values)
  write_long(*values)
  write_rational(*values)
  write_short(*values)
  write_signed_byte(*values)
  write_signed_long(*values)
  write_signed_rational(*values)
  write_signed_short(*values)
  write_string(value)
  write_undefined(value)

class PIL.TiffImagePlugin.TiffImageFile(fp=None, filename=None)

  Bases: `PIL.ImageFile.ImageFile`

  format = 'TIFF'
  format_description = 'Adobe TIFF'
  getxmp()

    Returns a dictionary containing the XMP tags. Requires defusedxml to be installed. :returns: XMP tags in a dictionary.

  load()

    Load image data based on tile list

  load_end()
  property n_frames
  seek(frame)

    Select a given frame as current image

  tag

    Legacy tag entries

  tag_v2

    Image file directory (tag dictionary)

  tell()

    Return the current frame number

## `WebPImagePlugin` Module

class PIL.WebPImagePlugin.WebPImageFile(fp=None, filename=None)

  Bases: `PIL.ImageFile.ImageFile`

  format = 'WEBP'
  format_description = 'WebP image'
  load()

    Load image data based on tile list

  seek(frame)

    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 `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()

    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=None, filename=None)

  Bases: `PIL.ImageFile.StubImageFile`

  format = 'WMF'
  format_description = 'Windows Metafile'
  load(dpi=None)

    Load image data based on tile list

PIL.WmfImagePlugin.register_handler(handler)

  Install application-specific WMF image handler.

  Parameters

    handler – Handler object.

## `XVThumbImagePlugin` Module

class PIL.XVThumbImagePlugin.XVThumbImageFile(fp=None, filename=None)

  Bases: `PIL.ImageFile.ImageFile`

  format = 'XVThumb'
  format_description = 'XV thumbnail image'

## `XbmImagePlugin` Module

class PIL.XbmImagePlugin.XbmImageFile(fp=None, filename=None)

  Bases: `PIL.ImageFile.ImageFile`

  format = 'XBM'
  format_description = 'X11 Bitmap'

## `XpmImagePlugin` Module

class PIL.XpmImagePlugin.XpmImageFile(fp=None, filename=None)

  Bases: `PIL.ImageFile.ImageFile`

  format = 'XPM'
  format_description = 'X11 Pixel Map'
  load_read(bytes)