2021.12.08 03:38 "[Tiff] Windows - difference in behavior when large RowsPerStrip is specified while writing Uncompressed vs LZW compressed TIFF file", by Nalini Vishnoi

2021.12.09 06:13 "Re: [Tiff] Windows - difference in behavior when large RowsPerStrip is specified while writing Uncompressed vs LZW compressed TIFF file", by Nalini Vishnoi

Hi Bob, Even and Paavo,

Thanks a lot for your super quick and helpful replies. 😊

@Bob – understood! I was going to create a bug request but then I saw Even’s reply and started trying out the patches/fixes he mentioned.

@Even – You are amazing!! Thank you so much for sharing both the fixes. I applied those in my current version of tiff (4.2.0) and they have fixed the following issues:

  1. With the ‘strip chopping’ fix, I can see now Windows is mimicking the same behavior as Linux where it is automatically changing the ‘RowsPerStrip’ from 25000 to 1 (for uncompressed files) in my example. It also explains why I saw the same behavior on Windows with tiff version 4.0.0 as Linux because for 4.0.0, we were using NMAKE but we switched to CMAKE (where the bug was) since 4.0.10.
  2. With the “long” fix, I can now read back the LZW compressed file successfully on Windows so indeed the root cause was “long” datatype used in tif_lzw.c which worked on Linux (64 bit) but failed on Windows (32 bit) as Paavo had suspected.

Not sure which response you referred to when you said “See my previous response”? Do you mean explanation here: https://www.asmail.be/msg0054930920.html?

@Paavo – Thanks again for your explanation. I have now understood the recommended way to write large TIFF files.

One last thing remaining for me to investigate and understand that I can observe the changing value of ‘RowsPerStrip’ tag for uncompressed files when I write a simple plain C++ file with tiff dynamic libraries. I am using simple call to TIFFGetField for RowsPerStrip. However, when I place the same call in my application which links against the tiff dynamic libraries on different platforms, I get the value that I wrote explicitly and I observe no change in the ‘RowsPerStrip’ tag. I have carefully inspected that I am calling the exact same function at both places but the results differ. The dynamic libraries are the exact same ones used in both cases.

Thanks,
Nalini