Skip to content

Commit f15837c

Browse files
committed
Support multi-page TIFF preview IFD chains
Add support for TIFF preview/preview-page IFD chains by introducing a page-oriented IFD slot and plumbing it through parsing, building, and time-patch logic. Key changes: - README wording clarified to describe bounded preview-page chain rewrite and preserved downstream tails. - Replaced Ifd1 with a generic page slot (ExifIfdSlot::IfdPage) and extended TransferExifIfdRef with page_index and is_page. - Added parse_ifd_page_index_name to parse numbered IFD names (ifdN). Classified page refs during metadata classification. - Store and handle page IFDs in vectors (page_ifds) instead of a single ifd1. Implemented resizing, sorting, entry serialization, value placement, and time-patch mapping for page IFDs. - Parsing: follow and validate preview IFD chains, prevent loops and excessive length, and populate parsed_exif.page_ifds. Preserve extra existing page IFDs when merging. - Writing: assemble page chains, set next offsets correctly, and ensure first_page_ifd_off is used as the rewritten next-ifd offset from IFD0. - Updated endian conversion and parsing/clearing logic to handle multiple page_ifds. - Tests: added helpers to construct minimal three-page TIFF/BigTIFF fixtures and multiple tests validating multi-page chain round-trip, tail preservation, and updated expectations (use >= offsets). Adjusted existing tests to assert chain behavior. These changes enable handling of multiple preview pages (ifdN) in EXIF/TIFF transfers, preserving existing downstream page tails and ensuring correct serialization/deserialization.
1 parent c99d107 commit f15837c

File tree

3 files changed

+603
-57
lines changed

3 files changed

+603
-57
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,13 +92,13 @@ Current target status:
9292

9393
In practice:
9494
- JPEG and TIFF are the strongest transfer targets today.
95-
- TIFF edit support now covers classic TIFF, BigTIFF, bounded `ifd1`
96-
chain rewrite with preserved downstream page tails, and bounded
95+
- TIFF edit support now covers classic TIFF, BigTIFF, bounded preview-page
96+
chain rewrite (`ifd1`, `ifd2`, and preserved downstream tails), and bounded
9797
TIFF/DNG-style SubIFD rewrite with preserved downstream auxiliary tails
9898
and preserved trailing existing children when only the front subset is
9999
replaced.
100100
- For DNG-like TIFF sources, the current bounded merge policy is:
101-
replace the source-supplied front preview/aux structures, preserve
101+
replace the source-supplied front preview-page/aux front structures, preserve
102102
existing target page tails and trailing auxiliary children.
103103
- PNG, WebP, JP2, JXL, bounded BMFF, and EXR all have real first-class
104104
transfer entry points.

0 commit comments

Comments
 (0)