feat(tiff): Support GPS fields, and other metadata enhancements#5050
feat(tiff): Support GPS fields, and other metadata enhancements#5050lgritz merged 7 commits intoAcademySoftwareFoundation:mainfrom
Conversation
|
The failures on the wheel builds are unrelated to this PR and are happening in main. We are investigating that separately, and it should not inhibit review and acceptance of this PR. |
Most visible change: The TIFF reader and writer now correctly handle GPS tags. Fixes 5049 But along the way, and to get it completely right, a fairly extensive refactoring of our TIFF tag handling was needed. The libtiff behavior around different tags is extremely convoluted, and there were a bunch of cases we either didn't handle correctly, or were dropping on the floor. So there are also some other non-GPS tags that we missed all along but now read properly. Note that the support for separate IFDs for GPS tags is only supported via the API in libtiff 4.2 and newer, so this is disabled when bulding against older libtiff versions. (Our support of old libtiff versions extends extraordinarily far back in time.) Signed-off-by: Larry Gritz <lg@larrygritz.com>
|
@kjellpeterson-shotover Are you able to tell if this patch satisfies your requirements as described in #5049 ? |
There was a problem hiding this comment.
Pull request overview
Adds proper TIFF GPS IFD read/write support (when building against libtiff ≥ 4.2) and refactors TIFF tag handling to preserve more Exif/TIFF metadata that was previously ignored or dropped.
Changes:
- Write GPS tags into a dedicated GPS IFD (libtiff ≥ 4.2) and read them back via TIFFTAG_GPSIFD scanning.
- Generalize TIFF tag extraction to correctly handle more libtiff field passing conventions (including multi-value fields like YCbCrSubsampling and PageNumber).
- Extend tests: add a GPS-tagged TIFF fixture and update reference outputs to reflect newly preserved metadata.
Reviewed changes
Copilot reviewed 19 out of 20 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| testsuite/tiff-suite/ref/out.txt | Updates golden output to include newly detected Exif/TIFF fields (e.g., ISO, PhotographicSensitivity, YCbCrSubsampling, PageNumber). |
| testsuite/tiff-suite/ref/out-jpeg9d-alt.txt | Same as above for jpeg9d-alt baseline. |
| testsuite/tiff-suite/ref/out-jpeg9b.txt | Same as above for jpeg9b baseline. |
| testsuite/tiff-suite/ref/out-alt2.txt | Same as above for alt2 baseline. |
| testsuite/tiff-suite/ref/out-alt.txt | Same as above for alt baseline. |
| testsuite/tiff-misc/src/gps.tif | Adds a GPS metadata fixture TIFF for round-trip testing. |
| testsuite/tiff-misc/run.py | Adds a GPS read/write test and info dump of the round-tripped output. |
| testsuite/tiff-misc/ref/out.txt | Updates baseline for older libtiff variants (no GPS IFD support). |
| testsuite/tiff-misc/ref/out-libtiff430.txt | Updates baseline for libtiff 4.3+ to include GPS tag output. |
| testsuite/tiff-misc/ref/out-libtiff410.txt | Updates baseline for libtiff 4.1 (no GPS IFD support). |
| testsuite/tiff-misc/ref/out-libtiff403.txt | Updates baseline for libtiff 4.0.3 (no GPS IFD support). |
| testsuite/tiff-misc/ref/out-libtiff403-c.txt | Updates baseline variant for libtiff 4.0.3-c (no GPS IFD support). |
| testsuite/tiff-misc/ref/out-libtiff403-b.txt | Updates baseline variant for libtiff 4.0.3-b (no GPS IFD support). |
| testsuite/tiff-misc/ref/out-libiff470.txt | Adds a new libtiff 4.7-specific baseline variant. |
| testsuite/misnamed-file/ref/out.txt | Updates golden output to include tiff:PageNumber. |
| src/tiff.imageio/tiffoutput.cpp | Refactors Exif writing to support GPS IFD writing and shared directory-writing helper. |
| src/tiff.imageio/tiffinput.cpp | Refactors tag reading to handle more libtiff calling conventions; adds GPS IFD scanning. |
| src/libOpenImageIO/exif.cpp | Fixes Exif:YCbCrSubsampling count and adds gps_tag_lookup implementation. |
| src/include/OpenImageIO/tiffutils.h | Exposes gps_tag_lookup in the public API. |
| src/cmake/externalpackages.cmake | Recommends libtiff ≥ 4.2 to unlock GPS IFD support. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Larry Gritz <lg@larrygritz.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Larry Gritz <lg@larrygritz.com>
Signed-off-by: Larry Gritz <lg@larrygritz.com>
Signed-off-by: Larry Gritz <lg@larrygritz.com>
Signed-off-by: Larry Gritz <lg@larrygritz.com>
|
Hi, sorry for the wait on that. I couldn't manage to include the PR in our project and test that way, but based on oiiotool built from the PR it seems like it should do what I was asking for. Thanks! |
|
Thanks for reporting back! |
…emySoftwareFoundation#5050) Most visible change: The TIFF reader and writer now correctly handle GPS tags. Fixes AcademySoftwareFoundation#5049 But along the way, and to get it completely right, a fairly extensive refactoring of our TIFF tag handling was needed. The libtiff behavior around different tags is extremely convoluted, and there were a bunch of cases we either didn't handle correctly, or were dropping on the floor. So there are also some other non-GPS tags that we missed all along but now read properly. Note that the support for separate IFDs for GPS tags is only supported via the API in libtiff 4.2 and newer, so this is disabled when bulding against older libtiff versions. (Our support of old libtiff versions extends extraordinarily far back in time.) --------- Signed-off-by: Larry Gritz <lg@larrygritz.com>
…emySoftwareFoundation#5050) Most visible change: The TIFF reader and writer now correctly handle GPS tags. Fixes AcademySoftwareFoundation#5049 But along the way, and to get it completely right, a fairly extensive refactoring of our TIFF tag handling was needed. The libtiff behavior around different tags is extremely convoluted, and there were a bunch of cases we either didn't handle correctly, or were dropping on the floor. So there are also some other non-GPS tags that we missed all along but now read properly. Note that the support for separate IFDs for GPS tags is only supported via the API in libtiff 4.2 and newer, so this is disabled when bulding against older libtiff versions. (Our support of old libtiff versions extends extraordinarily far back in time.) --------- Signed-off-by: Larry Gritz <lg@larrygritz.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Pascal Lecocq <pascal.lecocq@gmail.com>
Most visible change: The TIFF reader and writer now correctly handle GPS tags.
Fixes #5049
But along the way, and to get it completely right, a fairly extensive refactoring of our TIFF tag handling was needed. The libtiff behavior around different tags is extremely convoluted, and there were a bunch of cases we either didn't handle correctly, or were dropping on the floor. So there are also some other non-GPS tags that we missed all along but now read properly.
Note that the support for separate IFDs for GPS tags is only supported via the API in libtiff 4.2 and newer, so this is disabled when bulding against older libtiff versions. (Our support of old libtiff versions extends extraordinarily far back in time.)