image-tiff icon indicating copy to clipboard operation
image-tiff copied to clipboard

Support additional tags

Open powturns opened this issue 6 years ago • 4 comments

I'm trying to write a DNG encoder based on this code. I expect to run into several places where the library will need to be made more flexible. The first of these is storing the possible tag values in an enum, as it doesn't appear possible to add additional Tag values (such as those appearing in the TIFF/EP or DNG standards).

Suggestions for an approach are appreciated, otherwise I'll find something that works and submit in a merge request.

Thanks!

powturns avatar Jul 10 '19 04:07 powturns

This is cool, I would really like for this library to be usable for things like this. I would recommend to have a look at the Tag::Unknown variant and the Tag::from_u16 function if you need tags that are not defined by this library.

birktj avatar Jul 11 '19 15:07 birktj

Reference site for tags (including extended, experimental and private tags): https://www.awaresystems.be/imaging/tiff/tifftags.html

197g avatar Oct 31 '19 23:10 197g

As far as I am aware the reader can ignore unknown tags for the purpose of decoding an image matrix but weirdly enough some have an affect on the interpretation of the pixel matrix, such as

  • from baseline: PlanarConfiguration, ExtraSamples, ...
  • from extensions: WhitePoint, Predictor, PrimaryChromaticities, SampleFormat, TransferRange, possibly more.

The baseline tags should be support as soon as possible, the others would be nice-to-have to aim for full color correctness in upper layer users.

197g avatar Oct 31 '19 23:10 197g

I come back to this issue because i m writing some lib to manage geotiff and i also need additional tags. Currently i have to fork this lib and add my tags but it would be easier to just support additional tags. I also need to support BigTiff so by allowing me to use this lib as a dependency i could implement big tiff directly in this lib :) Also the is the cloud optimized geotiff (COG) format (allow the use of http range request), so i will need to allow decoding the file in multiple part (one ifd at time and have the choice to get directly the data from an offset or get the offset and query the data myself (For exemple TileOffsets can contain a lot of data for high resolution images)). I have also made some scheme on draw.io to represent the tiff/bigtiff format and help people to better understand how it's structured. Untitled Diagram tiff_structure.drawio.tar.gz

tiff_architecture

tiff_architecture.drawio.tar.gz

As you can see the data could be outside and entry and the Tag can contain a ref to the offset, we should add some information about the choice of the position of this data in this lib. I can make a PR to add this schemes to the README.md

Farkal avatar Jul 13 '20 14:07 Farkal