Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Interop to ExifTags #6724

Merged
merged 1 commit into from Nov 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
50 changes: 29 additions & 21 deletions docs/reference/ExifTags.rst
Expand Up @@ -4,8 +4,35 @@
:py:mod:`~PIL.ExifTags` Module
==============================

The :py:mod:`~PIL.ExifTags` module exposes two dictionaries which
provide constants and clear-text names for various well-known EXIF tags.
The :py:mod:`~PIL.ExifTags` module exposes several ``enum.IntEnum`` classes
which provide constants and clear-text names for various well-known EXIF tags.

.. py:data:: Base

>>> from PIL.ExifTags import Base
>>> Base.ImageDescription.value
270
>>> Base(270).name
'ImageDescription'

.. py:data:: GPS

>>> from PIL.ExifTags import GPS
>>> GPS.GPSDestLatitude.value
20
>>> GPS(20).name
'GPSDestLatitude'

.. py:data:: Interop

>>> from PIL.ExifTags import Interop
>>> Interop.RelatedImageFileFormat.value
4096
>>> Interop(4096).name
'RelatedImageFileFormat'


Two of these values are also exposed as dictionaries.

.. py:data:: TAGS
:type: dict
Expand All @@ -26,22 +53,3 @@ provide constants and clear-text names for various well-known EXIF tags.
>>> from PIL.ExifTags import GPSTAGS
>>> GPSTAGS[20]
'GPSDestLatitude'


These values are also exposed as ``enum.IntEnum`` classes.

.. py:data:: Base

>>> from PIL.ExifTags import Base
>>> Base.ImageDescription.value
270
>>> Base(270).name
'ImageDescription'

.. py:data:: GPS

>>> from PIL.ExifTags import GPS
>>> GPS.GPSDestLatitude.value
20
>>> GPS(20).name
'GPSDestLatitude'
8 changes: 8 additions & 0 deletions src/PIL/ExifTags.py
Expand Up @@ -338,3 +338,11 @@ class GPS(IntEnum):

"""Maps EXIF GPS tags to tag names."""
GPSTAGS = {i.value: i.name for i in GPS}


class Interop(IntEnum):
InteropIndex = 1
InteropVersion = 2
RelatedImageFileFormat = 4096
RelatedImageWidth = 4097
RleatedImageHeight = 4098