Plugin reference

BmpImagePlugin Module

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

Bases: PIL.ImageFile.ImageFile

format = 'BMP'
format_description = 'Windows Bitmap'
class PIL.BmpImagePlugin.DibImageFile(fp=None, filename=None)[source]

Bases: PIL.BmpImagePlugin.BmpImageFile

format = 'DIB'
format_description = 'Windows Bitmap'

BufrStubImagePlugin Module

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

Bases: PIL.ImageFile.StubImageFile

format = 'BUFR'
format_description = 'BUFR'
PIL.BufrStubImagePlugin.register_handler(handler)[source]

CurImagePlugin Module

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

Bases: PIL.BmpImagePlugin.BmpImageFile

format = 'CUR'
format_description = 'Windows Cursor'

DcxImagePlugin Module

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

Bases: PIL.PcxImagePlugin.PcxImageFile

format = 'DCX'
format_description = 'Intel DCX'
seek(frame)[source]

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.

Note that in the current version of the library, most sequence formats only allows you to seek to the next frame.

See tell().

Parameters:frame – Frame number, starting at 0.
Raises:EOFError – If the call attempts to seek beyond the end of the sequence.
tell()[source]

Returns the current frame number. See seek().

Returns:Frame number, starting with 0.

EpsImagePlugin Module

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

Bases: PIL.ImageFile.ImageFile

EPS File Parser for the Python Imaging Library

format = 'EPS'
format_description = 'Encapsulated Postscript'
load(scale=1)[source]

Load image data based on tile list

load_seek(*args, **kwargs)[source]
mode_map = {1: 'L', 2: 'LAB', 3: 'RGB'}
PIL.EpsImagePlugin.Ghostscript(tile, size, fp, scale=1)[source]

Render an image using Ghostscript

class PIL.EpsImagePlugin.PSFile(fp)[source]

Bases: object

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

readline()[source]
seek(offset, whence=0)[source]
PIL.EpsImagePlugin.has_ghostscript()[source]

FitsStubImagePlugin Module

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

Bases: PIL.ImageFile.StubImageFile

format = 'FITS'
format_description = 'FITS'
PIL.FitsStubImagePlugin.register_handler(handler)[source]

FliImagePlugin Module

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

Bases: PIL.ImageFile.ImageFile

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

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.

Note that in the current version of the library, most sequence formats only allows you to seek to the next frame.

See tell().

Parameters:frame – Frame number, starting at 0.
Raises:EOFError – If the call attempts to seek beyond the end of the sequence.
tell()[source]

Returns the current frame number. See seek().

Returns:Frame number, starting with 0.

FpxImagePlugin Module

class PIL.FpxImagePlugin.FpxImageFile(fp=None, filename=None)[source]

Bases: PIL.ImageFile.ImageFile

format = 'FPX'
format_description = 'FlashPix'
load()[source]

Load image data based on tile list

GbrImagePlugin Module

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

Bases: PIL.ImageFile.ImageFile

format = 'GBR'
format_description = 'GIMP brush file'
load()[source]

Load image data based on tile list

GifImagePlugin Module

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

Bases: PIL.ImageFile.ImageFile

data()[source]
format = 'GIF'
format_description = 'Compuserve GIF'
global_palette = None
load_end()[source]
seek(frame)[source]

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.

Note that in the current version of the library, most sequence formats only allows you to seek to the next frame.

See tell().

Parameters:frame – Frame number, starting at 0.
Raises:EOFError – If the call attempts to seek beyond the end of the sequence.
tell()[source]

Returns the current frame number. See seek().

Returns:Frame number, starting with 0.
PIL.GifImagePlugin.getdata(im, offset=(0, 0), **params)[source]

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

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

Return a list of strings representing a GIF header

GribStubImagePlugin Module

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

Bases: PIL.ImageFile.StubImageFile

format = 'GRIB'
format_description = 'GRIB'
PIL.GribStubImagePlugin.register_handler(handler)[source]

Hdf5StubImagePlugin Module

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

Bases: PIL.ImageFile.StubImageFile

format = 'HDF5'
format_description = 'HDF5'
PIL.Hdf5StubImagePlugin.register_handler(handler)[source]

IcnsImagePlugin Module

class PIL.IcnsImagePlugin.IcnsFile(fobj)[source]

Bases: object

SIZES = {(16, 16, 1): [(b'icp4', <function read_png_or_jpeg2000 at 0x7f5001654400>), (b'is32', <function read_32 at 0x7f5001654620>), (b's8mk', <function read_mk at 0x7f5001654488>)], (16, 16, 2): [(b'ic11', <function read_png_or_jpeg2000 at 0x7f5001654400>)], (32, 32, 1): [(b'icp5', <function read_png_or_jpeg2000 at 0x7f5001654400>), (b'il32', <function read_32 at 0x7f5001654620>), (b'l8mk', <function read_mk at 0x7f5001654488>)], (32, 32, 2): [(b'ic12', <function read_png_or_jpeg2000 at 0x7f5001654400>)], (48, 48, 1): [(b'ih32', <function read_32 at 0x7f5001654620>), (b'h8mk', <function read_mk at 0x7f5001654488>)], (64, 64, 1): [(b'icp6', <function read_png_or_jpeg2000 at 0x7f5001654400>)], (128, 128, 1): [(b'ic07', <function read_png_or_jpeg2000 at 0x7f5001654400>), (b'it32', <function read_32t at 0x7f5001654378>), (b't8mk', <function read_mk at 0x7f5001654488>)], (128, 128, 2): [(b'ic13', <function read_png_or_jpeg2000 at 0x7f5001654400>)], (256, 256, 1): [(b'ic08', <function read_png_or_jpeg2000 at 0x7f5001654400>)], (256, 256, 2): [(b'ic14', <function read_png_or_jpeg2000 at 0x7f5001654400>)], (512, 512, 1): [(b'ic09', <function read_png_or_jpeg2000 at 0x7f5001654400>)], (512, 512, 2): [(b'ic10', <function read_png_or_jpeg2000 at 0x7f5001654400>)]}
bestsize()[source]
dataforsize(size)[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=None)[source]
itersizes()[source]
class PIL.IcnsImagePlugin.IcnsImageFile(fp=None, filename=None)[source]

Bases: PIL.ImageFile.ImageFile

PIL read-only 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()[source]

Load image data based on tile list

PIL.IcnsImagePlugin.nextheader(fobj)[source]
PIL.IcnsImagePlugin.read_32(fobj, start_length, size)[source]

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)[source]
PIL.IcnsImagePlugin.read_mk(fobj, start_length, size)[source]
PIL.IcnsImagePlugin.read_png_or_jpeg2000(fobj, start_length, size)[source]

IcoImagePlugin Module

class PIL.IcoImagePlugin.IcoFile(buf)[source]

Bases: object

frame(idx)[source]

Get an image from frame idx

getimage(size, bpp=False)[source]

Get an image from the icon

sizes()[source]

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

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

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.

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

format = 'ICO'
format_description = 'Windows Icon'
load()[source]

Load image data based on tile list

load_seek()[source]

ImImagePlugin Module

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

Bases: PIL.ImageFile.ImageFile

format = 'IM'
format_description = 'IFUNC Image Memory'
seek(frame)[source]

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.

Note that in the current version of the library, most sequence formats only allows you to seek to the next frame.

See tell().

Parameters:frame – Frame number, starting at 0.
Raises:EOFError – If the call attempts to seek beyond the end of the sequence.
tell()[source]

Returns the current frame number. See seek().

Returns:Frame number, starting with 0.
PIL.ImImagePlugin.number(s)[source]

ImtImagePlugin Module

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

Bases: PIL.ImageFile.ImageFile

format = 'IMT'
format_description = 'IM Tools'

IptcImagePlugin Module

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

Bases: PIL.ImageFile.ImageFile

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

Load image data based on tile list

PIL.IptcImagePlugin.dump(c)[source]
PIL.IptcImagePlugin.getiptcinfo(im)[source]
PIL.IptcImagePlugin.i(c)[source]

JpegImagePlugin Module

PIL.JpegImagePlugin.APP(self, marker)[source]
PIL.JpegImagePlugin.COM(self, marker)[source]
PIL.JpegImagePlugin.DQT(self, marker)[source]
class PIL.JpegImagePlugin.JpegImageFile(fp=None, filename=None)[source]

Bases: PIL.ImageFile.ImageFile

draft(mode, size)[source]

Set draft mode

format = 'JPEG'
format_description = 'JPEG (ISO 10918)'
load_djpeg()[source]
PIL.JpegImagePlugin.SOF(self, marker)[source]
PIL.JpegImagePlugin.Skip(self, marker)[source]
PIL.JpegImagePlugin.convert_dict_qtables(qtables)[source]
PIL.JpegImagePlugin.get_sampling(im)[source]
PIL.JpegImagePlugin.jpeg_factory(fp=None, filename=None)[source]

Jpeg2KImagePlugin Module

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

Bases: PIL.ImageFile.ImageFile

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

Load image data based on tile list

McIdasImagePlugin Module

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

Bases: PIL.ImageFile.ImageFile

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

MicImagePlugin Module

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

Bases: PIL.TiffImagePlugin.TiffImageFile

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

Select a given frame as current image

tell()[source]

Return the current frame number

MpegImagePlugin Module

class PIL.MpegImagePlugin.BitStream(fp)[source]

Bases: object

next()[source]
peek(bits)[source]
read(bits)[source]
skip(bits)[source]
class PIL.MpegImagePlugin.MpegImageFile(fp=None, filename=None)[source]

Bases: PIL.ImageFile.ImageFile

format = 'MPEG'
format_description = 'MPEG'

MspImagePlugin Module

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

Bases: PIL.ImageFile.ImageFile

format = 'MSP'
format_description = 'Windows Paint'

PalmImagePlugin Module

PIL.PalmImagePlugin.build_prototype_image()[source]

PcdImagePlugin Module

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

Bases: PIL.ImageFile.ImageFile

draft(mode, size)[source]

Set draft mode

format = 'PCD'
format_description = 'Kodak PhotoCD'

PcxImagePlugin Module

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

Bases: PIL.ImageFile.ImageFile

format = 'PCX'
format_description = 'Paintbrush'

PdfImagePlugin Module

PixarImagePlugin Module

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

Bases: PIL.ImageFile.ImageFile

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

PngImagePlugin Module

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

Bases: PIL.ImageFile.ImageFile

load_end()[source]

internal: finished reading image data

load_prepare()[source]

internal: prepare to read PNG file

load_read(read_bytes)[source]

internal: read more image data

verify()[source]

Verify PNG file

PIL.PngImagePlugin.getchunks(im, **params)[source]

Return a list of PNG chunks representing this image.

PIL.PngImagePlugin.is_cid()

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

PIL.PngImagePlugin.putchunk(fp, cid, *data)[source]

Write a PNG chunk (including CRC field)

class PIL.PngImagePlugin.ChunkStream(fp)[source]

Bases: object

call(cid, pos, length)[source]

Call the appropriate chunk handler

close()[source]
crc(cid, data)[source]

Read and verify checksum

crc_skip(cid, data)[source]

Read checksum. Used if the C module is not present

push(cid, pos, length)[source]
read()[source]

Fetch a new chunk. Returns header information.

verify(endchunk=b'IEND')[source]
class PIL.PngImagePlugin.PngImageFile(fp=None, filename=None)[source]

Bases: PIL.ImageFile.ImageFile

format = 'PNG'
format_description = 'Portable network graphics'
load_end()[source]

internal: finished reading image data

load_prepare()[source]

internal: prepare to read PNG file

load_read(read_bytes)[source]

internal: read more image data

verify()[source]

Verify PNG file

class PIL.PngImagePlugin.PngStream(fp)[source]

Bases: PIL.PngImagePlugin.ChunkStream

chunk_IDAT(pos, length)[source]
chunk_IEND(pos, length)[source]
chunk_IHDR(pos, length)[source]
chunk_PLTE(pos, length)[source]
chunk_gAMA(pos, length)[source]
chunk_iCCP(pos, length)[source]
chunk_iTXt(pos, length)[source]
chunk_pHYs(pos, length)[source]
chunk_tEXt(pos, length)[source]
chunk_tRNS(pos, length)[source]
chunk_zTXt(pos, length)[source]

PpmImagePlugin Module

class PIL.PpmImagePlugin.PpmImageFile(fp=None, filename=None)[source]

Bases: PIL.ImageFile.ImageFile

format = 'PPM'
format_description = 'Pbmplus image'

PsdImagePlugin Module

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

Bases: PIL.ImageFile.ImageFile

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

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.

Note that in the current version of the library, most sequence formats only allows you to seek to the next frame.

See tell().

Parameters:frame – Frame number, starting at 0.
Raises:EOFError – If the call attempts to seek beyond the end of the sequence.
tell()[source]

Returns the current frame number. See seek().

Returns:Frame number, starting with 0.

SgiImagePlugin Module

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

Bases: PIL.ImageFile.ImageFile

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

SpiderImagePlugin Module

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

Bases: PIL.ImageFile.ImageFile

convert2byte(depth=255)[source]
format = 'SPIDER'
format_description = 'Spider 2D image'
seek(frame)[source]

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.

Note that in the current version of the library, most sequence formats only allows you to seek to the next frame.

See tell().

Parameters:frame – Frame number, starting at 0.
Raises:EOFError – If the call attempts to seek beyond the end of the sequence.
tell()[source]

Returns the current frame number. See seek().

Returns:Frame number, starting with 0.
tkPhotoImage()[source]
PIL.SpiderImagePlugin.isInt(f)[source]
PIL.SpiderImagePlugin.isSpiderHeader(t)[source]
PIL.SpiderImagePlugin.isSpiderImage(filename)[source]
PIL.SpiderImagePlugin.loadImageSeries(filelist=None)[source]

create a list of Image.images for use in montage

PIL.SpiderImagePlugin.makeSpiderHeader(im)[source]

SunImagePlugin Module

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

Bases: PIL.ImageFile.ImageFile

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

TgaImagePlugin Module

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

Bases: PIL.ImageFile.ImageFile

format = 'TGA'
format_description = 'Targa'

TiffImagePlugin Module

class PIL.TiffImagePlugin.ImageFileDirectory(prefix=b'II')[source]

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 ImageFileDirectory[key] = value value = ImageFileDirectory[key]

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

Data Structures: ‘public’ * self.tagtype = {} Key: numerical tiff tag number

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

‘internal’ * self.tags = {} Key: numerical tiff tag number

Value: Decoded data, Generally a tuple.
  • If set from __setval__ – always a tuple
  • Numeric types – always a tuple
  • String type – not a tuple, returned as string
  • Undefined data – not a tuple, returned as bytes
  • Byte – not a tuple, returned as byte.
  • self.tagdata = {} Key: numerical tiff tag number
    Value: undecoded byte string from file

Tags will be found in either self.tags or self.tagdata, but not both. The union of the two should contain all the tags from the Tiff image file. External classes shouldn’t reference these unless they’re really sure what they’re doing.

as_dict()[source]

Return a dictionary of the image’s tags.

getscalar(tag, default=None)[source]
items() → a set-like object providing a view on D's items[source]
load(fp)[source]
load_byte(data)[source]
load_dispatch = {1: (1, <function ImageFileDirectory.load_byte at 0x7f5000b6f048>), 2: (1, <function ImageFileDirectory.load_string at 0x7f5000b6f0d0>), 3: (2, <function ImageFileDirectory.load_short at 0x7f5000b6f158>), 4: (4, <function ImageFileDirectory.load_long at 0x7f5000b6f1e0>), 5: (8, <function ImageFileDirectory.load_rational at 0x7f5000b6f268>), 7: (1, <function ImageFileDirectory.load_undefined at 0x7f5000b6f400>), 11: (4, <function ImageFileDirectory.load_float at 0x7f5000b6f2f0>), 12: (8, <function ImageFileDirectory.load_double at 0x7f5000b6f378>)}
load_double(data)[source]
load_float(data)[source]
load_long(data)[source]
load_rational(data)[source]
load_short(data)[source]
load_string(data)[source]
load_undefined(data)[source]
named()[source]

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

reset()[source]
save(fp)[source]
class PIL.TiffImagePlugin.TiffImageFile(fp=None, filename=None)[source]

Bases: PIL.ImageFile.ImageFile

format = 'TIFF'
format_description = 'Adobe TIFF'
seek(frame)[source]

Select a given frame as current image

tell()[source]

Return the current frame number

WebPImagePlugin Module

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

Bases: PIL.ImageFile.ImageFile

format = 'WEBP'
format_description = 'WebP image'

WmfImagePlugin Module

class PIL.WmfImagePlugin.WmfStubImageFile(fp=None, filename=None)[source]

Bases: PIL.ImageFile.StubImageFile

format = 'WMF'
format_description = 'Windows Metafile'
PIL.WmfImagePlugin.register_handler(handler)[source]
PIL.WmfImagePlugin.short(c, o=0)[source]

XVThumbImagePlugin Module

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

Bases: PIL.ImageFile.ImageFile

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

XbmImagePlugin Module

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

Bases: PIL.ImageFile.ImageFile

format = 'XBM'
format_description = 'X11 Bitmap'

XpmImagePlugin Module

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

Bases: PIL.ImageFile.ImageFile

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