Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Working with .tif files ? #109

Open
ian-barber opened this issue Dec 1, 2022 · 1 comment
Open

Working with .tif files ? #109

ian-barber opened this issue Dec 1, 2022 · 1 comment

Comments

@ian-barber
Copy link

Using this on .jpg files works but not with .tif files

file2.Properties.Set(ExifTag.Make, "12345");

@rwg0
Copy link

rwg0 commented Apr 11, 2023

I just encountered the same issue - the Tiff code looks as though it was never quite finished and only deals with tags that are categorized as 'IFD.Zeroth'. It won't bother writing other tags, like ones categorized as IFD.Exif.

Workaround :

var id = (ExifTag)((int)ExifTag.Make % (int)IFD.Zeroth + (int)IFD.Zeroth);
file2.Properties.Set(id, "12345");

Why does it work? The code categorizes the tag IDs by adding 100000, 200000, 300000, etc to them (the IDs are 16 bit values). The TIFF code only deals with the range from 100000 (IFD.Zeroth) to 165535. So, by remapping the tag into that range, you trick the TIFF code into writing it out. As far as I can work out, the output file is correct providing your added tags are correct.

Note that there is also some special handling of tags when they are read for Exif tags that is missed because of this issue, but the workaround may be enough.

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

No branches or pull requests

2 participants