GEOTIFF ERROR: TIFFReadDirectory:Incorrect count for "SampleFormat"
What is the bug?
gdalinfo 325355935_col.tiff (attached) returns error:
ERROR 1: 325355935_col.tiff: TIFFReadDirectory:Incorrect count for "SampleFormat"
gdalinfo failed - unable to open '325355935_col.tiff'
Steps to reproduce the issue
See above
Versions and provenance
Windows 11 GDAL 3.12.0 "Chicoutimi", released 2025/11/03 using conda libgdal
Additional context
No response
gdalinfo 325355935_col.tiff(attached) returns error:
totally justified. This file is not a conformant TIFF file:
$ tiffdump 325355935_col.tiff
[...]
SamplesPerPixel (277) SHORT (3) 1<4>
[...]
SampleFormat (339) SHORT (3) 3<1 1 1>
So it advertizes 4 channels in SamplesPerPixel, but the SampleFormat tag only contains 3 values, wheras it should contain 4. This should be reported to the data producer
But Windows default Image app can open it. So maybe a specialized geospatial library also should...? ;-)
The Windows viewers were the only ones which could open the image in my short test. IrfanView, GIMP, and some others did not. Save a copy with the Windows viewer and GDAL will be happy with it. I wouldn't say that the image is fixed because by the specification https://www.itu.int/itudoc/itu-t/com16/tiff-fx/docs/tiff6.pdf SampleFormat and SamplesPerPixel are synchronized for a purpose.
libtiff enhancement to support that non-conformity in https://gitlab.com/libtiff/libtiff/-/merge_requests/770
This has been fixed both in upstream libtiff, and in the GDAL libtiff internal copy in d6a72c36be223065adf39fa58284598c3dbd3f00