Hi,
    You can prefill StripOffsets and StripByteCounts yourself by using
TIFFWriteRawStrip() calls with null data pointer and 0 size for all strips.
This should let you avoid changing directory size when you later write
actual data.

Olivier

Le jeu. 13 avr. 2023, à 08 h 16, David C. Partridge <
[email protected]> a écrit :

> I eventually worked out what was happening:
>
> The very act of writing the data added two additional fields to the base
> IFD - specifically:
>
>
>
> StripOffsets (3 Long): 514, 16771762, 33543010
>
> StripByteCounts (3 Long): 16771248, 16771248, 2496960
>
>
>
> They were added by the libtiff code internally (not by my code).
>
>
>
> Which meant that the base IFD was larger after writing the data than it
> was before. Thus, TIFFWriteDirectory over-wrote the EXIF IFD resulting in
> the EXIF IFD being overwritten … and the file therefore failed
> validation.   Therefore, there's no way to avoid the base IFD being at the
> end of the file.
>
_______________________________________________
Tiff mailing list
[email protected]
https://lists.osgeo.org/mailman/listinfo/tiff

Reply via email to