Hi Bob,

would it be possible to share the submitted code, how the TIFF IFD and the
EXIF IFD are handled.
Are the error reported below from GraphicsMagick? How to reproduce this
error?
Then I could have a look.

Handling such "Customer IFDs" was always a tricky thing, because the TIFF
IFD has to be written and re-read from file several times and IFDs have to
be switched in the correct way, especially for multi-image TIFF.  Some hints
about that could be found in the comments of custom_dir_EXIF_231.c and  at
https://libtiff.gitlab.io/libtiff/functions/TIFFCustomDirectory.html 

And between 4.5.0 and 4.5.1 we speed up moving between IFDs for TIFF files
having a huge number of IFDs (images) and handling of sub-IFDs.

Regards
Su


-----Ursprüngliche Nachricht-----
Von: Tiff [mailto:tiff-boun...@lists.osgeo.org] Im Auftrag von Bob
Friesenhahn via Tiff
Gesendet: Mittwoch, 20. Dezember 2023 23:07
An: Tiff List <tiff@lists.osgeo.org>
Betreff: [Tiff] EXIF tag writing fails starting with libtiff 4.5.1?

Recently a volunteer submitted code to GraphicsMagick's TIFF writer to
create an EXIF subifd.  When I tested this, it did not work for me. 
I was using latest libtiff from git.

I did some investigating and found that the code works for libtiff
4.4.0 and 4.5.0 but fails starting with 4.5.1.  Is anyone aware of changes
which might cause the issue (or detect a problem which was not detected
before)?

The test case writes three identical images in order, each with an identical
EXIF IFD.

The final errors reported are:

15:49:49 0:0.005317  0.000u 2345878 tiff.c/AddExifFields/4510/Coder:
   Extracted tag from EXIF 11ah, Field 5, Long2 1, val 17895 XResolution
15:49:49 0:0.005443  0.000u 2345878 tiff.c/TIFFWriteErrors/975/Coder:
   Ignored: Error fetching directory link. (TIFFRewriteDirectory)
15:49:49 0:0.005476  0.000u 2345878 tiff.c/TIFFWriteErrors/975/Coder:
   Ignored: Error fetching directory link. (TIFFRewriteDirectory)
15:49:49 0:0.006473  0.000u 2345878 tiff.c/WriteTIFFImage/6687/Coder:
   Removed broken output file "input_truecolor.tiff"
15:49:49 0:0.006495  0.000u 2345878
constitute.c/WriteImage/2325/Coder:  Returned from "TIFF" encoder, Failed
./utilities/gm convert: TIFF directory is missing required "ImageLength"
field. (MissingRequired).

Bob
--
Bob Friesenhahn
bfrie...@simple.dallas.tx.us, http://www.simplesystems.org/users/bfriesen/
GraphicsMagick Maintainer,    http://www.GraphicsMagick.org/
Public Key,     http://www.simplesystems.org/users/bfriesen/public-key.txt
_______________________________________________
Tiff mailing list
Tiff@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/tiff

_______________________________________________
Tiff mailing list
Tiff@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/tiff

Reply via email to