TiffTags Module#

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

PIL.TiffTags.lookup(tag)[source]#
Parameters:
  • tag – Integer tag number

  • group – Which TAGS_V2_GROUPS to look in

New in version 8.3.0.

Returns:

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

New in version 3.1.0.

class PIL.TiffTags.TagInfo[source]#
__init__(self, value=None, name='unknown', type=None, length=0, enum=None)#
Parameters:
  • 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)[source]#
Parameters:

value – The enumerated value name

Returns:

The integer corresponding to the name.

New in version 3.0.0.

PIL.TiffTags.TAGS_V2: dict#

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

New in version 3.0.0.

PIL.TiffTags.TAGS_V2_GROUPS: dict#

TAGS_V2 is one dimensional and doesn’t account for the fact that tags actually exist in different groups. This dictionary is used when the tag in question is part of a group.

New in version 8.3.0.

PIL.TiffTags.TAGS: dict#

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

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

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

PIL.TiffTags.TYPES: dict#

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

PIL.TiffTags.LIBTIFF_CORE: list#

A list of supported tag IDs when writing using LibTIFF.