TiffTags Module

The TiffTags module exposes many of the stantard TIFF metadata tag numbers, names, and type information.

参数:tag – Integer tag number
返回:Taginfo namedtuple, From the TAGS_V2 info if possible, otherwise just populating the value and name from TAGS. If the tag is not recognized, “unknown” is returned for the name

3.1.0 新版功能.

class PIL.TiffTags.TagInfo[源代码]
__init__(self, value=None, name="unknown", type=None, length=0, enum=None)
  • value – Integer Tag Number
  • name – Tag Name
  • type – Integer type from PIL.TiffTags.TYPES
  • length – Array length: 0 == variable, 1 == single value, n = fixed
  • enum – Dict of name:integer value options for an enumeration
cvt_enum(self, value)[源代码]
参数:value – The enumerated value name
返回:The integer corresponding to the name.

3.0.0 新版功能.


The TAGS_V2 dictionary maps 16-bit integer tag numbers to PIL.TagTypes.TagInfo tuples for metadata fields defined in the TIFF spec.

3.0.0 新版功能.


The TAGS dictionary maps 16-bit integer TIFF tag number to descriptive string names. For instance:

>>> from PIL.TiffTags import TAGS
>>> TAGS[0x010e]

This dictionary contains a superset of the tags in TAGS_V2, common EXIF tags, and other well known metadata tags.


The TYPES dictionary maps the TIFF type short integer to a human readable type name.