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

Reading (private) IFD tags

Open Christopher22 opened this issue 3 years ago • 2 comments

Am I correct that there is currently no way to read (private) IFD Tags like "GpsIFD"? However, the necessary parsing method is already implemented and even the offset of the tag is available (tiff::decoder::ifd::Value::Ifd(offset)).

By extending read_ifd, I would offer to add the missing function pub fn get_tag_ifd(&mut self, tag: Tag) -> TiffResult<tiff::decoder::ifd::Directory>.

Are there any opinions or criticism regarding that plan?

Christopher22 avatar Jun 16 '21 09:06 Christopher22

Overall I think your plan seems reasonable. I do wonder whether the tags in a GpsIFD have the same meanings as in a normal IFD? There's also a risk that get_tag_ifd would leave the decoder in a weird state, but that shouldn't be too hard to avoid.

fintelia avatar Jun 16 '21 15:06 fintelia

What exactly do you mean with "same meaning"? :) As I understand the standard, all tags live in a namespace of their own and are private to the particular type. As such, I am even allowed to use i. e. tag 256 (ImageWidth) with a completely different meaning within this tag.

Christopher22 avatar Jun 17 '21 06:06 Christopher22