Convert relative makernote offsets to absolute offsets
|Assignee:||Andreas Huggel||% Done:|
Some makernotes use IFD offsets relative to the beginning of the makernote (or somewhere near the beginning of the makernote). This has certain advantages, but it complicates matters for users who would like to follow the offset (e.g., to access a preview image pointed to from a makernote tag of a TIFF image).
Thus relative offsets should be converted to absolute offsets.
Essentially this requires adding the base offset to the tag value. And then removing it again before writing the value back. Parsing the Exif/TIFF metadata is a 2 step process: first it is read into a TiffComponent tree (TiffReader), then the metadata is extracted from the components of the tree into the metadata containers (TiffDecoder). The base offset is available in the reader, but not in the decoder. To implement this properly, logic similar to that in the reader has to be added to the decoder to "change state" (which includes the base offset). This would make the base offset available when the tag is decoded. The same applies when writing metadata back for the encoder (which is used for "non-intrusive writing) and finally the write functions need to be adjusted.
#1 Updated by Andreas Huggel over 8 years ago
Note that absolute offsets means offsets from the start of the image file / memory area, not just the start of the TIFF header. This is relevant for image formats with an embedded Exif block (eg, JPEG)
Should there be another set of synthesized tags, pointing to the start of the TIFF header: Exif.TiffHeader.Offset (and Exif.TiffHeader.ByteOrder, etc)