Add GPSHPositioningError to GPS IFD tag data - #9941
Merged
radarhere merged 3 commits intoSep 4, 2026
Merged
Conversation
Exif 2.32 table 15 defines GPSHPositioningError (31) as RATIONAL with a count of 1, and ExifTags.GPS already contains it, but it was missing from the GPSInfoIFD entry in TiffTags. Without tag data, the type is guessed from the Python value, so a float was written as DOUBLE and an int as SHORT.
Member
|
As an explanation for why this was missed, https://web.archive.org/web/20240428063145/https://www.awaresystems.be/imaging/tiff/tifftags/privateifd/gps.html doesn't mention this tag, but it was added in Exif 2.31. |
Member
|
I've created dylanpulver#1 with a suggestion. |
radarhere
reviewed
Sep 4, 2026
radarhere
enabled auto-merge (squash)
September 4, 2026 02:53
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes proposed in this pull request:
31: ("GPSHPositioningError", RATIONAL, 1)to the GPSInfoIFD entry ofTiffTags._tags_v2_groupsExif 2.32 table 15 defines GPSHPositioningError (31) as RATIONAL, count 1.
ExifTags.GPSalready has it, but the GPS tag data added in #6661 stops at 30, soTiffTags.lookup(31, 34853).typeisNoneandImageFileDirectory_v2._setitemguesses the type from the Python value instead:GPSDOP is the control here: same spec type and count, different result. piexif, checked separately, declares tag 31 as type 5 and writes type 5.
#6661 was opened for #6657, where GPS data written by Pillow was not readable in other programs, so this is the same table one entry further.
Rejected alternative: making the float branch of
_setitemguess RATIONAL rather than DOUBLE fixes the float case but leaves the int case wrong, and it abortsTests/test_file_libtiff.py::test_custom_metadatahere.Not changed, in case you want it separately:
RelatedImageFileFormat,RelatedImageWidthandRelatedImageHeightare inExifTags.Interopbut not in the InteroperabilityIFD tag data. The types guessed for them are currently spec-legal, so nothing is written wrongly today.macOS arm64, Python 3.12:
python -m pytest Testsgives 5179 passed before and 5183 after, the +4 being the new parametrised cases, with the same single pre-existing failure both times (test_imagegrab.py::TestImageGrab::test_grab, screen recording permission on this machine). ruff 0.16.1 and black 26.5.1 clean on both files. Reverting only the table line fails the two tag-31 cases; the two tag-11 cases pass either way and are there as controls.AI assistance: the diff, the test and this description were drafted by Claude Opus 5 working as a coding agent in this repository.