Plugin reference

BmpImagePlugin Module

class PIL.BmpImagePlugin.BmpImageFile(fp=None, filename=None)[源代码]

基类: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'
class PIL.BmpImagePlugin.DibImageFile(fp=None, filename=None)[源代码]

基类:PIL.BmpImagePlugin.BmpImageFile

format = 'DIB'
format_description = 'Windows Bitmap'

BufrStubImagePlugin Module

class PIL.BufrStubImagePlugin.BufrStubImageFile(fp=None, filename=None)[源代码]

基类:PIL.ImageFile.StubImageFile

format = 'BUFR'
format_description = 'BUFR'
PIL.BufrStubImagePlugin.register_handler(handler)[源代码]

CurImagePlugin Module

class PIL.CurImagePlugin.CurImageFile(fp=None, filename=None)[源代码]

基类:PIL.BmpImagePlugin.BmpImageFile

format = 'CUR'
format_description = 'Windows Cursor'

DcxImagePlugin Module

class PIL.DcxImagePlugin.DcxImageFile(fp=None, filename=None)[源代码]

基类:PIL.PcxImagePlugin.PcxImageFile

format = 'DCX'
format_description = 'Intel DCX'
is_animated
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.

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

See tell().

参数:frame – Frame number, starting at 0.
引发:EOFError – If the call attempts to seek beyond the end of the sequence.
tell()[源代码]

Returns the current frame number. See seek().

返回:Frame number, starting with 0.

EpsImagePlugin Module

class PIL.EpsImagePlugin.EpsImageFile(fp=None, filename=None)[源代码]

基类:PIL.ImageFile.ImageFile

EPS File Parser for the Python Imaging Library

format = 'EPS'
format_description = 'Encapsulated Postscript'
load(scale=1)[源代码]

Load image data based on tile list

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

Render an image using Ghostscript

class PIL.EpsImagePlugin.PSFile(fp)[源代码]

基类: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)[源代码]

基类:PIL.ImageFile.StubImageFile

format = 'FITS'
format_description = 'FITS'
PIL.FitsStubImagePlugin.register_handler(handler)[源代码]

FliImagePlugin Module

class PIL.FliImagePlugin.FliImageFile(fp=None, filename=None)[源代码]

基类:PIL.ImageFile.ImageFile

format = 'FLI'
format_description = 'Autodesk FLI/FLC Animation'
is_animated
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.

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

See tell().

参数:frame – Frame number, starting at 0.
引发:EOFError – If the call attempts to seek beyond the end of the sequence.
tell()[源代码]

Returns the current frame number. See seek().

返回:Frame number, starting with 0.

FpxImagePlugin Module

class PIL.FpxImagePlugin.FpxImageFile(fp=None, filename=None)[源代码]

基类: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)[源代码]

基类: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)[源代码]

基类:PIL.ImageFile.ImageFile

data()[源代码]
format = 'GIF'
format_description = 'Compuserve GIF'
global_palette = None
is_animated
load_end()[源代码]
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.

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

See tell().

参数:frame – Frame number, starting at 0.
引发:EOFError – If the call attempts to seek beyond the end of the sequence.
tell()[源代码]

Returns the current frame number. See seek().

返回:Frame number, starting with 0.
PIL.GifImagePlugin.get_interlace(im)[源代码]
PIL.GifImagePlugin.getdata(im, offset=(0, 0), **params)[源代码]

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)[源代码]

Return a list of strings representing a GIF header

GribStubImagePlugin Module

class PIL.GribStubImagePlugin.GribStubImageFile(fp=None, filename=None)[源代码]

基类:PIL.ImageFile.StubImageFile

format = 'GRIB'
format_description = 'GRIB'
PIL.GribStubImagePlugin.register_handler(handler)[源代码]

Hdf5StubImagePlugin Module

class PIL.Hdf5StubImagePlugin.HDF5StubImageFile(fp=None, filename=None)[源代码]

基类:PIL.ImageFile.StubImageFile

format = 'HDF5'
format_description = 'HDF5'
PIL.Hdf5StubImagePlugin.register_handler(handler)[源代码]

IcnsImagePlugin Module

class PIL.IcnsImagePlugin.IcnsFile(fobj)[源代码]

基类: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)[源代码]

基类: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

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)[源代码]

基类:object

frame(idx)[源代码]

Get an image from frame idx

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)[源代码]

基类: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/archive/p/casadebender/wikis/Win32IconImagePlugin.wiki

format = 'ICO'
format_description = 'Windows Icon'
load()[源代码]

Load image data based on tile list

load_seek()[源代码]

ImImagePlugin Module

class PIL.ImImagePlugin.ImImageFile(fp=None, filename=None)[源代码]

基类:PIL.ImageFile.ImageFile

format = 'IM'
format_description = 'IFUNC Image Memory'
is_animated
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.

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

See tell().

参数:frame – Frame number, starting at 0.
引发:EOFError – If the call attempts to seek beyond the end of the sequence.
tell()[源代码]

Returns the current frame number. See seek().

返回:Frame number, starting with 0.
PIL.ImImagePlugin.number(s)[源代码]

ImtImagePlugin Module

class PIL.ImtImagePlugin.ImtImageFile(fp=None, filename=None)[源代码]

基类:PIL.ImageFile.ImageFile

format = 'IMT'
format_description = 'IM Tools'

IptcImagePlugin Module

class PIL.IptcImagePlugin.IptcImageFile(fp=None, filename=None)[源代码]

基类: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)[源代码]
PIL.IptcImagePlugin.i(c)[源代码]

JpegImagePlugin Module

Jpeg2KImagePlugin Module

class PIL.Jpeg2KImagePlugin.Jpeg2KImageFile(fp=None, filename=None)[源代码]

基类:PIL.ImageFile.ImageFile

format = 'JPEG2000'
format_description = 'JPEG 2000 (ISO 15444)'
load()[源代码]

Load image data based on tile list

McIdasImagePlugin Module

class PIL.McIdasImagePlugin.McIdasImageFile(fp=None, filename=None)[源代码]

基类:PIL.ImageFile.ImageFile

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

MicImagePlugin Module

MpegImagePlugin Module

class PIL.MpegImagePlugin.BitStream(fp)[源代码]

基类:object

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

基类:PIL.ImageFile.ImageFile

format = 'MPEG'
format_description = 'MPEG'

MspImagePlugin Module

class PIL.MspImagePlugin.MspImageFile(fp=None, filename=None)[源代码]

基类:PIL.ImageFile.ImageFile

format = 'MSP'
format_description = 'Windows Paint'

PalmImagePlugin Module

PcdImagePlugin Module

class PIL.PcdImagePlugin.PcdImageFile(fp=None, filename=None)[源代码]

基类:PIL.ImageFile.ImageFile

format = 'PCD'
format_description = 'Kodak PhotoCD'

PcxImagePlugin Module

class PIL.PcxImagePlugin.PcxImageFile(fp=None, filename=None)[源代码]

基类:PIL.ImageFile.ImageFile

format = 'PCX'
format_description = 'Paintbrush'

PdfImagePlugin Module

PixarImagePlugin Module

class PIL.PixarImagePlugin.PixarImageFile(fp=None, filename=None)[源代码]

基类:PIL.ImageFile.ImageFile

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

PngImagePlugin Module

class PIL.PngImagePlugin.PngImageFile(fp=None, filename=None)[源代码]

基类:PIL.ImageFile.ImageFile

load_end()[源代码]

internal: finished reading image data

load_prepare()[源代码]

internal: prepare to read PNG file

load_read(read_bytes)[源代码]

internal: read more image data

verify()[源代码]

Verify PNG file

PIL.PngImagePlugin.getchunks(im, **params)[源代码]

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)[源代码]

Write a PNG chunk (including CRC field)

class PIL.PngImagePlugin.ChunkStream(fp)[源代码]

基类: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)[源代码]

基类:PIL.ImageFile.ImageFile

format = 'PNG'
format_description = 'Portable network graphics'
load_end()[源代码]

internal: finished reading image data

load_prepare()[源代码]

internal: prepare to read PNG file

load_read(read_bytes)[源代码]

internal: read more image data

verify()[源代码]

Verify PNG file

class PIL.PngImagePlugin.PngStream(fp)[源代码]

基类:PIL.PngImagePlugin.ChunkStream

check_text_memory(chunklen)[源代码]
chunk_IDAT(pos, length)[源代码]
chunk_IEND(pos, length)[源代码]
chunk_IHDR(pos, length)[源代码]
chunk_PLTE(pos, length)[源代码]
chunk_gAMA(pos, length)[源代码]
chunk_iCCP(pos, length)[源代码]
chunk_iTXt(pos, length)[源代码]
chunk_pHYs(pos, length)[源代码]
chunk_tEXt(pos, length)[源代码]
chunk_tRNS(pos, length)[源代码]
chunk_zTXt(pos, length)[源代码]

PpmImagePlugin Module

class PIL.PpmImagePlugin.PpmImageFile(fp=None, filename=None)[源代码]

基类:PIL.ImageFile.ImageFile

format = 'PPM'
format_description = 'Pbmplus image'

PsdImagePlugin Module

class PIL.PsdImagePlugin.PsdImageFile(fp=None, filename=None)[源代码]

基类:PIL.ImageFile.ImageFile

format = 'PSD'
format_description = 'Adobe Photoshop'
is_animated
load_prepare()[源代码]
n_frames
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.

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

See tell().

参数:frame – Frame number, starting at 0.
引发:EOFError – If the call attempts to seek beyond the end of the sequence.
tell()[源代码]

Returns the current frame number. See seek().

返回:Frame number, starting with 0.

SgiImagePlugin Module

class PIL.SgiImagePlugin.SgiImageFile(fp=None, filename=None)[源代码]

基类:PIL.ImageFile.ImageFile

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

SpiderImagePlugin Module

class PIL.SpiderImagePlugin.SpiderImageFile(fp=None, filename=None)[源代码]

基类:PIL.ImageFile.ImageFile

convert2byte(depth=255)[源代码]
format = 'SPIDER'
format_description = 'Spider 2D image'
is_animated
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.

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

See tell().

参数:frame – Frame number, starting at 0.
引发:EOFError – If the call attempts to seek beyond the end of the sequence.
tell()[源代码]

Returns the current frame number. See seek().

返回: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.images for use in montage

PIL.SpiderImagePlugin.makeSpiderHeader(im)[源代码]

SunImagePlugin Module

class PIL.SunImagePlugin.SunImageFile(fp=None, filename=None)[源代码]

基类:PIL.ImageFile.ImageFile

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

TgaImagePlugin Module

class PIL.TgaImagePlugin.TgaImageFile(fp=None, filename=None)[源代码]

基类:PIL.ImageFile.ImageFile

format = 'TGA'
format_description = 'Targa'

TiffImagePlugin Module

WebPImagePlugin Module

class PIL.WebPImagePlugin.WebPImageFile(fp=None, filename=None)[源代码]

基类:PIL.ImageFile.ImageFile

format = 'WEBP'
format_description = 'WebP image'

WmfImagePlugin Module

class PIL.WmfImagePlugin.WmfStubImageFile(fp=None, filename=None)[源代码]

基类:PIL.ImageFile.StubImageFile

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

XVThumbImagePlugin Module

class PIL.XVThumbImagePlugin.XVThumbImageFile(fp=None, filename=None)[源代码]

基类:PIL.ImageFile.ImageFile

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

XbmImagePlugin Module

class PIL.XbmImagePlugin.XbmImageFile(fp=None, filename=None)[源代码]

基类:PIL.ImageFile.ImageFile

format = 'XBM'
format_description = 'X11 Bitmap'

XpmImagePlugin Module

class PIL.XpmImagePlugin.XpmImageFile(fp=None, filename=None)[源代码]

基类:PIL.ImageFile.ImageFile

format = 'XPM'
format_description = 'X11 Pixel Map'
load_read(bytes)[源代码]