插件引用

BmpImagePlugin 模块

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

基类:PIL.ImageFile.ImageFile

Windows位图格式(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)[源代码]

基类:PIL.BmpImagePlugin.BmpImageFile

format = 'DIB'
format_description = 'Windows Bitmap'

BufrStubImagePlugin 模块

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

基类:PIL.ImageFile.StubImageFile

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

安装特定于应用程序的BUFR映像处理程序。

参数

handler -- 处理程序对象。

CurImagePlugin 模块

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

基类:PIL.BmpImagePlugin.BmpImageFile

format = 'CUR'
format_description = 'Windows Cursor'

DcxImagePlugin 模块

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

基类:PIL.PcxImagePlugin.PcxImageFile

format = 'DCX'
format_description = 'Intel DCX'
property is_animated
property n_frames
seek(frame)[源代码]

查找此序列文件中的给定帧。如果在序列结尾之外查找,该方法将引发 EOFError 例外。打开序列文件时,库自动查找第0帧。

tell() .

参数

frame -- 帧编号,从0开始。

引发

EOFError -- 如果调用试图在序列结束后查找。

tell()[源代码]

返回当前帧号。见 seek() .

返回

帧编号,从0开始。

EpsImagePlugin 模块

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

基类:PIL.ImageFile.ImageFile

python图像库的eps文件分析器

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

基于平铺列表加载图像数据

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

使用ghostscript渲染图像

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

基类:object

将cr或lf视为行尾的bytesio对象的包装。

readline()[源代码]
seek(offset, whence=0)[源代码]
PIL.EpsImagePlugin.has_ghostscript()[源代码]

FitsStubImagePlugin 模块

class PIL.FitsStubImagePlugin.FITSStubImageFile(fp=None, filename=None)[源代码]

基类:PIL.ImageFile.StubImageFile

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

安装特定于应用程序的Fit图像处理程序。

参数

handler -- 处理程序对象。

FliImagePlugin 模块

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

基类:PIL.ImageFile.ImageFile

format = 'FLI'
format_description = 'Autodesk FLI/FLC Animation'
property is_animated
property n_frames
seek(frame)[源代码]

查找此序列文件中的给定帧。如果在序列结尾之外查找,该方法将引发 EOFError 例外。打开序列文件时,库自动查找第0帧。

tell() .

参数

frame -- 帧编号,从0开始。

引发

EOFError -- 如果调用试图在序列结束后查找。

tell()[源代码]

返回当前帧号。见 seek() .

返回

帧编号,从0开始。

FpxImagePlugin 模块

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

基类:PIL.ImageFile.ImageFile

format = 'FPX'
format_description = 'FlashPix'
load()[源代码]

基于平铺列表加载图像数据

GbrImagePlugin 模块

class PIL.GbrImagePlugin.GbrImageFile(fp=None, filename=None)[源代码]

基类:PIL.ImageFile.ImageFile

format = 'GBR'
format_description = 'GIMP brush file'
load()[源代码]

基于平铺列表加载图像数据

GifImagePlugin 模块

class PIL.GifImagePlugin.GifImageFile(fp=None, filename=None)[源代码]

基类:PIL.ImageFile.ImageFile

data()[源代码]
format = 'GIF'
format_description = 'Compuserve GIF'
global_palette = None
property is_animated
load_end()[源代码]
property n_frames
seek(frame)[源代码]

查找此序列文件中的给定帧。如果在序列结尾之外查找,该方法将引发 EOFError 例外。打开序列文件时,库自动查找第0帧。

tell() .

参数

frame -- 帧编号,从0开始。

引发

EOFError -- 如果调用试图在序列结束后查找。

tell()[源代码]

返回当前帧号。见 seek() .

返回

帧编号,从0开始。

PIL.GifImagePlugin.get_interlace(im)[源代码]
PIL.GifImagePlugin.getdata(im, offset=(0, 0), **params)[源代码]

遗留方法

返回表示此图像的字符串列表。第一个字符串是本地图像头,其余字符串包含编码的图像数据。

参数
  • im -- 图像对象

  • offset -- (x,y)像素的元组。默认为(0,0)

  • **params -- 例如,持续时间或其他编码器信息参数

返回

包含GIF编码帧数据的字节列表

PIL.GifImagePlugin.getheader(im, palette=None, info=None)[源代码]

从图像中获取GIF数据的传统方法。

警告::可能会修改图像数据。

参数
  • im -- 图像对象

  • palette -- 包含源调色板的bytes对象,或….

  • info -- 编码信息

返回

(标题项列表,优化调色板)的元组

GribStubImagePlugin 模块

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

基类:PIL.ImageFile.StubImageFile

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

安装特定于应用程序的GRIB映像处理程序。

参数

handler -- 处理程序对象。

Hdf5StubImagePlugin 模块

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

基类:PIL.ImageFile.StubImageFile

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

安装特定于应用程序的HDF5图像处理程序。

参数

handler -- 处理程序对象。

IcnsImagePlugin 模块

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

获取图标资源作为通道:数组。请注意,数组是自底向上的,类似于Windows位图,可能需要以某种方式翻转或转置。

getimage(size=None)[源代码]
itersizes()[源代码]
class PIL.IcnsImagePlugin.IcnsImageFile(fp=None, filename=None)[源代码]

基类:PIL.ImageFile.ImageFile

对mac os.icns文件的pil映像支持。选择最佳分辨率,但如果在调用“load”之前改变大小属性,则可能加载不同大小的图像。

信息字典有一个键“大小”,它是ICN文件的大小列表。

format = 'ICNS'
format_description = 'Mac OS icns resource'
load()[源代码]

基于平铺列表加载图像数据

property size
PIL.IcnsImagePlugin.nextheader(fobj)[源代码]
PIL.IcnsImagePlugin.read_32(fobj, start_length, size)[源代码]

读取32位RGB图标资源。似乎要么是未压缩的,要么是一个像rle-packbits的方案。

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 模块

class PIL.IcoImagePlugin.IcoFile(buf)[源代码]

基类:object

frame(idx)[源代码]

从帧IDX获取图像

getentryindex(size, bpp=False)[源代码]
getimage(size, bpp=False)[源代码]

从图标中获取图像

sizes()[源代码]

获取所有可用图标大小和颜色深度的列表。

class PIL.IcoImagePlugin.IcoImageFile(fp=None, filename=None)[源代码]

基类:PIL.ImageFile.ImageFile

PIL只读图像支持Microsoft Windows.ico文件。

默认情况下,将加载文件中的最大分辨率图像。这可以通过在调用“load”之前更改“size”属性来更改。

信息字典有一个键“大小”,它是图标文件中可用大小的列表。

处理经典、XP和Vista图标格式。

保存时,使用PNG压缩。仅在Windows Vista中添加了对此的支持。

此插件是bryan davis<casadebender@gmail.com>重构的win32iconimageplugin版本。https://code.google.com/archive/p/casadebender/wikis/win32iconimageplugin.wiki

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

基于平铺列表加载图像数据

load_seek()[源代码]
property size

ImImagePlugin 模块

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

基类:PIL.ImageFile.ImageFile

format = 'IM'
format_description = 'IFUNC Image Memory'
property is_animated
property n_frames
seek(frame)[源代码]

查找此序列文件中的给定帧。如果在序列结尾之外查找,该方法将引发 EOFError 例外。打开序列文件时,库自动查找第0帧。

tell() .

参数

frame -- 帧编号,从0开始。

引发

EOFError -- 如果调用试图在序列结束后查找。

tell()[源代码]

返回当前帧号。见 seek() .

返回

帧编号,从0开始。

PIL.ImImagePlugin.number(s)[源代码]

ImtImagePlugin 模块

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

基类:PIL.ImageFile.ImageFile

format = 'IMT'
format_description = 'IM Tools'

IptcImagePlugin 模块

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

基类:PIL.ImageFile.ImageFile

field()[源代码]
format = 'IPTC'
format_description = 'IPTC/NAA'
getint(key)[源代码]
load()[源代码]

基于平铺列表加载图像数据

PIL.IptcImagePlugin.dump(c)[源代码]
PIL.IptcImagePlugin.getiptcinfo(im)[源代码]

从TIFF、JPEG或IPTC文件获取IPTC信息。

参数

im -- 包含IPTC数据的图像。

返回

包含IPTC信息的字典,如果找不到IPTC信息块,则为“无”。

PIL.IptcImagePlugin.i(c)[源代码]

JpegImagePlugin 模块

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

基类:PIL.ImageFile.ImageFile

draft(mode, size)[源代码]

配置 Mapfile 加载程序,使其返回尽可能与给定模式和大小匹配的映像版本。例如,可以使用此方法在加载彩色JPEG时将其转换为灰度。

如果进行了任何更改,则返回一个带有 modebox 原始图像的坐标在修改后的图像内。

请注意,此方法修改了 Image 物体就位。如果图像已加载,则此方法无效。

注意:此方法不适用于大多数图像。它目前只为JPEG和MPO图像实现。

参数
  • mode -- 请求的模式。

  • size -- 请求的大小。

format = 'JPEG'
format_description = 'JPEG (ISO 10918)'
load_djpeg()[源代码]
load_read(read_bytes)[源代码]

内部:为过早的EOF读取更多的图像数据,并加载“截断”的图像添加EOI标记,以便libjpeg完成解码。

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 模块

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

基类:PIL.ImageFile.ImageFile

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

基于平铺列表加载图像数据

McIdasImagePlugin 模块

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

基类:PIL.ImageFile.ImageFile

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

MicImagePlugin 模块

class PIL.MicImagePlugin.MicImageFile(fp=None, filename=None)[源代码]

基类:PIL.TiffImagePlugin.TiffImageFile

format = 'MIC'
format_description = 'Microsoft Image Composer'
property is_animated
property n_frames
seek(frame)[源代码]

选择给定帧作为当前图像

tell()[源代码]

返回当前帧号

MpegImagePlugin 模块

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 模块

class PIL.MspImagePlugin.MspDecoder(mode, *args)[源代码]

基类:PIL.ImageFile.PyDecoder

decode(buffer)[源代码]

重写以执行解码过程。

参数

buffer -- 带有要解码的数据的bytes对象。

返回

(已消耗字节,错误代码)的元组。如果解码结束,则对于消耗的字节返回<0。错误代码来自'errors'`

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

基类:PIL.ImageFile.ImageFile

format = 'MSP'
format_description = 'Windows Paint'

PalmImagePlugin 模块

PIL.PalmImagePlugin.build_prototype_image()[源代码]

PcdImagePlugin 模块

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

基类:PIL.ImageFile.ImageFile

format = 'PCD'
format_description = 'Kodak PhotoCD'
load_end()[源代码]

PcxImagePlugin 模块

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

基类:PIL.ImageFile.ImageFile

format = 'PCX'
format_description = 'Paintbrush'

PdfImagePlugin 模块

PixarImagePlugin 模块

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

基类:PIL.ImageFile.ImageFile

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

PngImagePlugin 模块

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

基类:PIL.ImageFile.ImageFile

load_end()[源代码]

内部:读取完图像数据

load_prepare()[源代码]

内部:准备读取PNG文件

load_read(read_bytes)[源代码]

内部:读取更多图像数据

verify()[源代码]

验证PNG文件

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

返回表示此图像的PNG块列表。

PIL.PngImagePlugin.is_cid()

匹配字符串开头的零个或多个字符。

PIL.PngImagePlugin.putchunk(fp, cid, *data)[源代码]

写入PNG块(包括CRC字段)

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

基类:object

call(cid, pos, length)[源代码]

调用适当的块处理程序

close()[源代码]
crc(cid, data)[源代码]

读取并验证校验和

crc_skip(cid, data)[源代码]

读取校验和。C模块不存在时使用

push(cid, pos, length)[源代码]
read()[源代码]

获取新块。返回头信息。

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

基类:PIL.ImageFile.ImageFile

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

内部:读取完图像数据

load_prepare()[源代码]

内部:准备读取PNG文件

load_read(read_bytes)[源代码]

内部:读取更多图像数据

property text
verify()[源代码]

验证PNG文件

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_acTL(pos, length)[源代码]
chunk_cHRM(pos, length)[源代码]
chunk_eXIf(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)[源代码]

PpmImagePlugin 模块

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

基类:PIL.ImageFile.ImageFile

format = 'PPM'
format_description = 'Pbmplus image'

PsdImagePlugin 模块

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

基类:PIL.ImageFile.ImageFile

format = 'PSD'
format_description = 'Adobe Photoshop'
property is_animated
load_prepare()[源代码]
property n_frames
seek(layer)[源代码]

查找此序列文件中的给定帧。如果在序列结尾之外查找,该方法将引发 EOFError 例外。打开序列文件时,库自动查找第0帧。

tell() .

参数

frame -- 帧编号,从0开始。

引发

EOFError -- 如果调用试图在序列结束后查找。

tell()[源代码]

返回当前帧号。见 seek() .

返回

帧编号,从0开始。

SgiImagePlugin 模块

class PIL.SgiImagePlugin.SGI16Decoder(mode, *args)[源代码]

基类:PIL.ImageFile.PyDecoder

decode(buffer)[源代码]

重写以执行解码过程。

参数

buffer -- 带有要解码的数据的bytes对象。

返回

(已消耗字节,错误代码)的元组。如果解码结束,则对于消耗的字节返回<0。错误代码来自'errors'`

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

基类:PIL.ImageFile.ImageFile

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

SpiderImagePlugin 模块

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

基类:PIL.ImageFile.ImageFile

convert2byte(depth=255)[源代码]
format = 'SPIDER'
format_description = 'Spider 2D image'
property is_animated
property n_frames
seek(frame)[源代码]

查找此序列文件中的给定帧。如果在序列结尾之外查找,该方法将引发 EOFError 例外。打开序列文件时,库自动查找第0帧。

tell() .

参数

frame -- 帧编号,从0开始。

引发

EOFError -- 如果调用试图在序列结束后查找。

tell()[源代码]

返回当前帧号。见 seek() .

返回

帧编号,从0开始。

tkPhotoImage()[源代码]
PIL.SpiderImagePlugin.isInt(f)[源代码]
PIL.SpiderImagePlugin.isSpiderHeader(t)[源代码]
PIL.SpiderImagePlugin.isSpiderImage(filename)[源代码]
PIL.SpiderImagePlugin.loadImageSeries(filelist=None)[源代码]

创建的列表 Image 蒙太奇中使用的对象

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

SunImagePlugin 模块

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

基类:PIL.ImageFile.ImageFile

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

TgaImagePlugin 模块

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

基类:PIL.ImageFile.ImageFile

format = 'TGA'
format_description = 'Targa'

TiffImagePlugin 模块

class PIL.TiffImagePlugin.AppendingTiffWriter(fn, new=False)[源代码]

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

基类:numbers.Rational

实现一个Rational类,其中0/0是一个合法值,以匹配在野外使用的exif理性。

例如,DigitalZoomRatio-0.00/0.00表示未使用数码变焦。

property denominator
limit_rational(max_denominator)[源代码]
参数

max_denominator -- 整数,最大分母值

返回

(分子、分母)的元组

property numerator
PIL.TiffImagePlugin.ImageFileDirectory

PIL.TiffImagePlugin.ImageFileDirectory_v1 的别名

class PIL.TiffImagePlugin.ImageFileDirectory_v1(*args, **kwargs)[源代码]

基类:PIL.TiffImagePlugin.ImageFileDirectory_v2

此类表示 legacy 接口到TIFF标记目录。

显示目录中标记的字典接口::

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

还包含从TIFF图像文件中读取的标记类型字典,~pil.tiffImagePlugin.ImageFileDirectory_v1.tagType

值作为元组返回。

3.0.0 版后已移除.

classmethod from_v2(original)[源代码]

返回一个 ImageFileDirectory_v1 与原始中包含的数据相同的实例 ImageFileDirectory_v2 实例。

返回

ImageFileDirectory_v1

property tagdata
property tags
to_v2()[源代码]

返回一个 ImageFileDirectory_v2 与原始中包含的数据相同的实例 ImageFileDirectory_v1 实例。

返回

ImageFileDirectory_v2

class PIL.TiffImagePlugin.ImageFileDirectory_v2(ifh=b'II*x00x00x00x00x00', prefix=None)[源代码]

基类:collections.abc.MutableMapping

此类表示TIFF标记目录。为了加快速度,我们不会解码标签,除非有人要求。

显示目录中标记的字典接口::

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

单个值作为字符串或数字返回,序列作为值的元组返回。

每个项目的TIFF元数据类型存储在`~pil.tiffImagePlugin.ImageFileDirectory_v2.TagType`中的标记类型字典中。这些类型是从TIFF文件中读取、从添加的类型中猜测或手动添加的。

数据结构:

  • self.tagtype=

    • 键:数字TIFF标记号

    • 值:与来自的数据类型对应的整数

      ~PIL.TiffTags.TYPES`

3.0.0 新版功能.

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

名称键的dict:value

返回完整的标记字典,尽可能使用命名标记。

property offset
property prefix
reset()[源代码]
save(fp)[源代码]
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)[源代码]

基类:PIL.ImageFile.ImageFile

format = 'TIFF'
format_description = 'Adobe TIFF'
property is_animated
load()[源代码]

基于平铺列表加载图像数据

load_end()[源代码]
property n_frames
seek(frame)[源代码]

选择给定帧作为当前图像

tell()[源代码]

返回当前帧号

WebPImagePlugin 模块

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

基类:PIL.ImageFile.ImageFile

format = 'WEBP'
format_description = 'WebP image'
property is_animated
load()[源代码]

基于平铺列表加载图像数据

property n_frames
seek(frame)[源代码]

查找此序列文件中的给定帧。如果在序列结尾之外查找,该方法将引发 EOFError 例外。打开序列文件时,库自动查找第0帧。

tell() .

参数

frame -- 帧编号,从0开始。

引发

EOFError -- 如果调用试图在序列结束后查找。

tell()[源代码]

返回当前帧号。见 seek() .

返回

帧编号,从0开始。

WmfImagePlugin 模块

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

基类:PIL.ImageFile.StubImageFile

format = 'WMF'
format_description = 'Windows Metafile'
load(dpi=None)[源代码]

基于平铺列表加载图像数据

PIL.WmfImagePlugin.register_handler(handler)[源代码]

安装特定于应用程序的WMF映像处理程序。

参数

handler -- 处理程序对象。

XVThumbImagePlugin 模块

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

基类:PIL.ImageFile.ImageFile

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

XbmImagePlugin 模块

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

基类:PIL.ImageFile.ImageFile

format = 'XBM'
format_description = 'X11 Bitmap'

XpmImagePlugin 模块

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

基类:PIL.ImageFile.ImageFile

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