From 6d9d4af1921e63e937b7426736a3ce1751af4c68 Mon Sep 17 00:00:00 2001 From: Melon Mouse <73140350+melonmouse@users.noreply.github.com> Date: Fri, 16 Sep 2022 10:48:37 +0200 Subject: [PATCH] Add inverse mappings for exif tags. A nicer solution would be to switch to an enum with the right values, but this is the quick win. --- src/PIL/ExifTags.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/PIL/ExifTags.py b/src/PIL/ExifTags.py index 7da2ddae5..15e8010b6 100644 --- a/src/PIL/ExifTags.py +++ b/src/PIL/ExifTags.py @@ -293,6 +293,11 @@ TAGS = { } """Maps EXIF tags to tag names.""" +TAG_CODES = { + # possibly incomplete + tag_name: tag_code for tag_code, tag_name in TAGS.items() +} +"""Maps tag names to EXIF tags.""" GPSTAGS = { 0: "GPSVersionID", @@ -329,3 +334,6 @@ GPSTAGS = { 31: "GPSHPositioningError", } """Maps EXIF GPS tags to tag names.""" + +GPS_CODES = {gps_name: gps_code for gps_code, gps_name in GPSTAGS.items()} +"""Maps tag names to EXIF GPS tags."""