插件引用#
BmpImagePlugin
模块#
- class PIL.BmpImagePlugin.BmpImageFile(fp=None, filename=None)[源代码]#
基类:
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.BmpRleDecoder(mode, *args)[源代码]#
基类:
PyDecoder
- decode(buffer)[源代码]#
重写以执行解码过程。
- 参数:
buffer -- 带有要解码的数据的bytes对象。
- 返回:
的元组
(bytes consumed, errcode)
。如果完成解码,则为消耗的字节返回-1。错误代码来自ImageFile.ERRORS
。
- class PIL.BmpImagePlugin.DibImageFile(fp=None, filename=None)[源代码]#
基类:
BmpImageFile
- format = 'DIB'#
- format_description = 'Windows Bitmap'#
BufrStubImagePlugin
模块#
CurImagePlugin
模块#
- class PIL.CurImagePlugin.CurImageFile(fp=None, filename=None)[源代码]#
基类:
BmpImageFile
- format = 'CUR'#
- format_description = 'Windows Cursor'#
DcxImagePlugin
模块#
- class PIL.DcxImagePlugin.DcxImageFile(fp=None, filename=None)[源代码]#
基类:
PcxImageFile
- format = 'DCX'#
- format_description = 'Intel DCX'#
EpsImagePlugin
模块#
- class PIL.EpsImagePlugin.EpsImageFile(fp=None, filename=None)[源代码]#
基类:
ImageFile
python图像库的eps文件分析器
- format = 'EPS'#
- format_description = 'Encapsulated Postscript'#
- mode_map = {1: 'L', 2: 'LAB', 3: 'RGB', 4: 'CMYK'}#
FitsImagePlugin
模块#
FliImagePlugin
模块#
- class PIL.FliImagePlugin.FliImageFile(fp=None, filename=None)[源代码]#
基类:
ImageFile
- format = 'FLI'#
- format_description = 'Autodesk FLI/FLC Animation'#
FpxImagePlugin
模块#
GbrImagePlugin
模块#
GifImagePlugin
模块#
- class PIL.GifImagePlugin.GifImageFile(fp=None, filename=None)[源代码]#
基类:
ImageFile
- format = 'GIF'#
- format_description = 'Compuserve GIF'#
- global_palette = None#
- property is_animated#
- property n_frames#
- PIL.GifImagePlugin.LOADING_STRATEGY = LoadingStrategy.RGB_AFTER_FIRST#
在 9.1.0 版本加入.
- class PIL.GifImagePlugin.LoadingStrategy(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[源代码]#
基类:
IntEnum
在 9.1.0 版本加入.
- RGB_AFTER_DIFFERENT_PALETTE_ONLY = 1#
- RGB_AFTER_FIRST = 0#
- RGB_ALWAYS = 2#
GribStubImagePlugin
模块#
Hdf5StubImagePlugin
模块#
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>)]}#
- class PIL.IcnsImagePlugin.IcnsImageFile(fp=None, filename=None)[源代码]#
基类:
ImageFile
对mac os.icns文件的pil映像支持。选择最佳分辨率,但如果在调用“load”之前改变大小属性,则可能加载不同大小的图像。
信息字典有一个键“大小”,它是ICN文件的大小列表。
- format = 'ICNS'#
- format_description = 'Mac OS icns resource'#
- property size#
IcoImagePlugin
模块#
- class PIL.IcoImagePlugin.IcoImageFile(fp=None, filename=None)[源代码]#
基类:
ImageFile
PIL只读图像支持Microsoft Windows.ico文件。
默认情况下,将加载文件中的最大分辨率图像。这可以通过在调用“load”之前更改“size”属性来更改。
信息字典有一个键“大小”,它是图标文件中可用大小的列表。
处理经典、XP和Vista图标格式。
保存时,使用PNG压缩。仅在Windows Vista中添加了对此的支持。如果无法在Windows中查看图标,请在保存前将图像转换为“RGBA”模式。
此插件是bryan davis<casadebender@gmail.com>重构的win32iconimageplugin版本。https://code.google.com/archive/p/casadebender/wikis/win32iconimageplugin.wiki
- format = 'ICO'#
- format_description = 'Windows Icon'#
- property size#
ImImagePlugin
模块#
- class PIL.ImImagePlugin.ImImageFile(fp=None, filename=None)[源代码]#
基类:
ImageFile
- format = 'IM'#
- format_description = 'IFUNC Image Memory'#
- property is_animated#
- property n_frames#
ImtImagePlugin
模块#
IptcImagePlugin
模块#
- class PIL.IptcImagePlugin.IptcImageFile(fp=None, filename=None)[源代码]#
基类:
ImageFile
- format = 'IPTC'#
- format_description = 'IPTC/NAA'#
JpegImagePlugin
模块#
- class PIL.JpegImagePlugin.JpegImageFile(fp=None, filename=None)[源代码]#
基类:
ImageFile
- draft(mode, size)[源代码]#
配置 Mapfile 加载程序,使其返回尽可能与给定模式和大小匹配的映像版本。例如,可以使用此方法在加载彩色JPEG时将其转换为灰度。
如果进行了任何更改,则返回一个带有
mode
和box
原始图像的坐标在修改后的图像内。请注意,此方法修改了
Image
物体就位。如果图像已加载,则此方法无效。注意:此方法不适用于大多数图像。它目前只为JPEG和MPO图像实现。
- 参数:
mode -- 请求的模式。
size -- 以像素为单位的请求大小,作为2元组:(宽度、高度)。
- format = 'JPEG'#
- format_description = 'JPEG (ISO 10918)'#
Jpeg2KImagePlugin
模块#
- class PIL.Jpeg2KImagePlugin.BoxReader(fp, length=-1)[源代码]#
基类:
object
一个小帮助器类,用于读取存储在JPEG2000标题框中的字段,并轻松地步入和读取子框。
- class PIL.Jpeg2KImagePlugin.Jpeg2KImageFile(fp=None, filename=None)[源代码]#
基类:
ImageFile
- format = 'JPEG2000'#
- format_description = 'JPEG 2000 (ISO 15444)'#
- property reduce#
返回缩小的图像的副本
factor
泰晤士报。如果图像的大小不能被factor
,则结果大小将向上舍入。- 参数:
factor -- 宽度和高度分别大于0的整数或两个整数的元组。
box -- 提供要缩小的源图像区域的可选4元组整数。这些值必须在
(0, 0, width, height)
矩形。如果省略或None
,则使用整个源。
McIdasImagePlugin
模块#
MicImagePlugin
模块#
MpegImagePlugin
模块#
MspImagePlugin
模块#
PalmImagePlugin
模块#
PcdImagePlugin
模块#
PcxImagePlugin
模块#
PdfImagePlugin
模块#
PixarImagePlugin
模块#
PngImagePlugin
模块#
- class PIL.PngImagePlugin.Blend(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[源代码]#
基类:
IntEnum
- OP_OVER = 1#
该帧应该与先前的输出图像内容进行Alpha合成。看见 Saving APNG sequences 。
- OP_SOURCE = 0#
该帧的所有颜色分量,包括Alpha,都会覆盖以前的输出图像内容。看见 Saving APNG sequences 。
- class PIL.PngImagePlugin.Disposal(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[源代码]#
基类:
IntEnum
- OP_BACKGROUND = 1#
在渲染下一帧之前,该帧的修改区域被清除为完全透明的黑色。看见 Saving APNG sequences 。
- OP_NONE = 0#
在渲染下一帧之前,不会对该帧进行任何处理。看见 Saving APNG sequences 。
- OP_PREVIOUS = 2#
在渲染下一帧之前,该帧的修改区域将恢复为上一帧的内容。看见 Saving APNG sequences 。
- class PIL.PngImagePlugin.PngImageFile(fp=None, filename=None)[源代码]#
基类:
ImageFile
- seek(frame)[源代码]#
查找此序列文件中的给定帧。如果在序列结尾之外查找,该方法将引发
EOFError
例外。打开序列文件时,库自动查找第0帧。见
tell()
.如果定义了,
n_frames
指可用帧数。- 参数:
frame -- 帧编号,从0开始。
- 抛出:
EOFError -- 如果调用试图在序列结束后查找。
- format = 'PNG'#
- format_description = 'Portable network graphics'#
- property text#
- class PIL.PngImagePlugin.PngStream(fp)[源代码]#
基类:
ChunkStream
- PIL.PngImagePlugin.is_cid(string, pos=0, endpos=9223372036854775807)#
匹配字符串开头的零个或多个字符。
- PIL.PngImagePlugin.MAX_TEXT_CHUNK = 1048576#
ITXT或zTXt块的最大解压缩大小。消除了压缩块可以扩展1000倍的解压缩炸弹。看见 Text in PNG File Format 。
- PIL.PngImagePlugin.MAX_TEXT_MEMORY = 67108864#
设置最大总文本块大小。看见 Text in PNG File Format 。
PpmImagePlugin
模块#
- class PIL.PpmImagePlugin.PpmDecoder(mode, *args)[源代码]#
基类:
PyDecoder
- decode(buffer)[源代码]#
重写以执行解码过程。
- 参数:
buffer -- 带有要解码的数据的bytes对象。
- 返回:
的元组
(bytes consumed, errcode)
。如果完成解码,则为消耗的字节返回-1。错误代码来自ImageFile.ERRORS
。
PsdImagePlugin
模块#
- class PIL.PsdImagePlugin.PsdImageFile(fp=None, filename=None)[源代码]#
基类:
ImageFile
- format = 'PSD'#
- format_description = 'Adobe Photoshop'#
SgiImagePlugin
模块#
SpiderImagePlugin
模块#
- class PIL.SpiderImagePlugin.SpiderImageFile(fp=None, filename=None)[源代码]#
基类:
ImageFile
- format = 'SPIDER'#
- format_description = 'Spider 2D image'#
- property is_animated#
- property n_frames#
SunImagePlugin
模块#
TgaImagePlugin
模块#
TiffImagePlugin
模块#
- class PIL.TiffImagePlugin.AppendingTiffWriter(fn, new=False)[源代码]#
基类:
object
- Tags = {273, 288, 324, 519, 520, 521}#
- fieldSizes = [0, 1, 1, 2, 4, 8, 1, 1, 2, 4, 8, 4, 8, 4, 2, 4, 8]#
- class PIL.TiffImagePlugin.IFDRational(value, denominator=1)[源代码]#
基类:
Rational
实现一个Rational类,其中0/0是一个合法值,以匹配在野外使用的exif理性。
例如,DigitalZoomRatio-0.00/0.00表示未使用数码变焦。
- property denominator#
- property numerator#
- PIL.TiffImagePlugin.ImageFileDirectory#
- class PIL.TiffImagePlugin.ImageFileDirectory_v1(*args, **kwargs)[源代码]#
-
此类表示 legacy 接口到TIFF标记目录。
显示目录中标记的字典接口::
ifd = ImageFileDirectory_v1() ifd[key] = 'Some Data' ifd.tagtype[key] = TiffTags.ASCII print(ifd[key]) ('Some Data',)
还包含从TIFF图像文件读取的标签类型的字典,
tagtype
。值作为元组返回。
自 3.0.0 版本弃用.
- classmethod from_v2(original)[源代码]#
返回一个
ImageFileDirectory_v1
与原始中包含的数据相同的实例ImageFileDirectory_v2
实例。
- property tagdata#
- property tags#
- to_v2()[源代码]#
返回一个
ImageFileDirectory_v2
与原始中包含的数据相同的实例ImageFileDirectory_v1
实例。
- class PIL.TiffImagePlugin.ImageFileDirectory_v2(ifh=b'II*\x00\x00\x00\x00\x00', prefix=None, group=None)[源代码]#
-
此类表示TIFF标记目录。为了加快速度,我们不会解码标签,除非有人要求。
显示目录中标记的字典接口::
ifd = ImageFileDirectory_v2() ifd[key] = 'Some Data' ifd.tagtype[key] = TiffTags.ASCII print(ifd[key]) 'Some Data'
单个值作为字符串或数字返回,序列作为值的元组返回。
每个项目的TIFF元数据类型存储在中的标签类型字典中
tagtype
。类型从TIFF文件读取、从添加的类型猜测或手动添加。数据结构:
self.tagtype = {}
键:数字TIFF标签号
值:与中的数据类型对应的整数
TiffTags.TYPES
在 3.0.0 版本加入.
“内部”数据结构:
self._tags_v2 = {}
键:数字TIFF标签号
值:解码的数据,作为多个值的元组
self._tagdata = {}
键:数字TIFF标签号
值:来自文件的未解码字节串
self._tags_v1 = {}
键:数字TIFF标签号
值:v1格式的解码数据
标签将在私有属性中找到
self._tagdata
,以及在self._tags_v2
一旦被破译。self.legacy_api
是内部使用的值,不应从外部代码更改。与ImageFileDirectory_v1
,如果legacy_api
为真,则解码的标记将填充到_tags_v1
和_tags_v2
。_tags_v2
如果在TIFF保存例程中使用此IFD,则将使用此IFD。标签应从以下位置读取_tags_v1
如果legacy_api == true
。- property legacy_api#
- load_double(data, legacy_api=True)#
- load_float(data, legacy_api=True)#
- load_long(data, legacy_api=True)#
- load_long8(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_short(data, legacy_api=True)#
- property offset#
- property prefix#
- tagtype#
标签类型字典
- write_double(*values)#
- write_float(*values)#
- write_long(*values)#
- write_long8(*values)#
- write_short(*values)#
- write_signed_byte(*values)#
- write_signed_long(*values)#
- write_signed_short(*values)#
- class PIL.TiffImagePlugin.TiffImageFile(fp=None, filename=None)[源代码]#
基类:
ImageFile
- format = 'TIFF'#
- format_description = 'Adobe TIFF'#
- get_photoshop_blocks()[源代码]#
返回Photoshop“图像资源块”的词典。密钥为图片资源ID,详情请参考https://www.adobe.com/devnet-apps/photoshop/fileformatashtml/#50577409_pgfId-1037727
- 返回:
Photoshop词典中的“图像资源块”。
- property n_frames#
- tag#
传统标签条目
- tag_v2#
图像文件目录(标记字典)
WebPImagePlugin
模块#
- class PIL.WebPImagePlugin.WebPImageFile(fp=None, filename=None)[源代码]#
基类:
ImageFile
- format = 'WEBP'#
- format_description = 'WebP image'#