Skip to content

fix(tiff): Correctly read TIFF EXIF fields for ExifVersion and FlashPixVersion - #5045

Merged
lgritz merged 1 commit into
AcademySoftwareFoundation:mainfrom
lgritz:lg-tiffexifread
Feb 14, 2026
Merged

fix(tiff): Correctly read TIFF EXIF fields for ExifVersion and FlashPixVersion#5045
lgritz merged 1 commit into
AcademySoftwareFoundation:mainfrom
lgritz:lg-tiffexifread

Conversation

@lgritz

@lgritz lgritz commented Feb 12, 2026

Copy link
Copy Markdown
Collaborator

This allows us to correctly read the ExifVersion and FlashPixVersion metadata in an EXIF block of a TIFF file.

This allows us to correctly read the ExifVersion and FlashPixVersion
metadata in an EXIF block of a TIFF file.

Signed-off-by: Larry Gritz <lg@larrygritz.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request fixes the reading of EXIF ExifVersion and FlashPixVersion metadata fields from TIFF files. Previously, these fields were being skipped despite having handler functions defined. The fix adds special-case handling in the TIFF input code to properly read these 4-byte undefined-type fields as strings.

Changes:

  • Added special handling in tiffinput.cpp to read ExifVersion and FlashPixVersion as 4-character strings
  • Enhanced safe_tiffgetfield to support fields that require passing a count parameter
  • Fixed a syntax error and improved type consistency in debug code in exif.cpp
  • Updated test reference outputs to reflect the newly-readable metadata fields

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

File Description
src/tiff.imageio/tiffinput.cpp Added special case handling for EXIF_EXIFVERSION and EXIF_FLASHPIXVERSION in find_tag(), and extended safe_tiffgetfield() to handle passcount fields
src/tiff.imageio/tiffoutput.cpp Changed debug output conditionals from #ifndef NDEBUG to #if 0 to unconditionally disable verbose debug messages
src/libOpenImageIO/exif.cpp Fixed syntax error in debug print statement, changed 200L to 200UL for type consistency, added #ifdef guard for EXIF_TIFF_UTF8, and removed misleading comments about skipping version tags
testsuite/tiff-suite/ref/*.txt Updated test reference outputs to include the newly-readable Exif:ExifVersion and Exif:FlashPixVersion fields for test images

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +1205 to 1208
# if 0
print("Unhandled EXIF {} ({}) / tag {} tifftype {} count {}\n",
p.name(), p.type(), tag, tifftype, count);
# endif

Copilot AI Feb 13, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The debug output has been unconditionally disabled by changing from #ifndef NDEBUG to #if 0. This means these debug messages will never be printed, even in debug builds. If this is intentional to reduce noise, consider using a more specific debug flag (like #if DEBUG_TIFF_EXIF) to allow selective enabling when needed for debugging EXIF-related issues.

Copilot uses AI. Check for mistakes.
Comment on lines +1212 to +1216
# if 0
print(
"Error handling EXIF {} ({}) / tag {} tifftype {} count {}\n",
p.name(), p.type(), tag, tifftype, count);
# endif

Copilot AI Feb 13, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar to above, this debug output has been unconditionally disabled by changing from commented code to #if 0. Consider using a named debug flag for more granular control if these messages would be useful for debugging EXIF write operations.

Copilot uses AI. Check for mistakes.
@lgritz
lgritz merged commit 0457774 into AcademySoftwareFoundation:main Feb 14, 2026
62 of 63 checks passed
lgritz added a commit to lgritz/OpenImageIO that referenced this pull request Feb 15, 2026
…ixVersion (AcademySoftwareFoundation#5045)

This allows us to correctly read the ExifVersion and FlashPixVersion
metadata in an EXIF block of a TIFF file.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
ssh4net pushed a commit to ssh4net/OpenImageIO that referenced this pull request Feb 24, 2026
…ixVersion (AcademySoftwareFoundation#5045)

This allows us to correctly read the ExifVersion and FlashPixVersion
metadata in an EXIF block of a TIFF file.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
Signed-off-by: Vlad (Kuzmin) Erium <libalias@gmail.com>
@lgritz
lgritz deleted the lg-tiffexifread branch March 2, 2026 21:37
ssh4net pushed a commit to ssh4net/OpenImageIO that referenced this pull request Apr 1, 2026
…ixVersion (AcademySoftwareFoundation#5045)

This allows us to correctly read the ExifVersion and FlashPixVersion
metadata in an EXIF block of a TIFF file.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
Signed-off-by: Vlad <shaamaan@gmail.com>
ssh4net pushed a commit to ssh4net/OpenImageIO that referenced this pull request Apr 2, 2026
…ixVersion (AcademySoftwareFoundation#5045)

This allows us to correctly read the ExifVersion and FlashPixVersion
metadata in an EXIF block of a TIFF file.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
Signed-off-by: Vlad (Kuzmin) Erium <libalias@gmail.com>
ssh4net pushed a commit to ssh4net/OpenImageIO that referenced this pull request Apr 2, 2026
…ixVersion (AcademySoftwareFoundation#5045)

This allows us to correctly read the ExifVersion and FlashPixVersion
metadata in an EXIF block of a TIFF file.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
Signed-off-by: Vlad (Kuzmin) Erium <libalias@gmail.com>
ssh4net pushed a commit to ssh4net/OpenImageIO that referenced this pull request Apr 2, 2026
…ixVersion (AcademySoftwareFoundation#5045)

This allows us to correctly read the ExifVersion and FlashPixVersion
metadata in an EXIF block of a TIFF file.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
Signed-off-by: Vlad (Kuzmin) Erium <libalias@gmail.com>
Signed-off-by: Vlad <shaamaan@gmail.com>
ssh4net pushed a commit to ssh4net/OpenImageIO that referenced this pull request Apr 2, 2026
…ixVersion (AcademySoftwareFoundation#5045)

This allows us to correctly read the ExifVersion and FlashPixVersion
metadata in an EXIF block of a TIFF file.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
Signed-off-by: Vlad (Kuzmin) Erium <libalias@gmail.com>
Signed-off-by: Vlad <shaamaan@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants