assume SAMPLEFORMAT_UINT for tiff files when SAMPLEFORMAT_VOID is set

This commit is contained in:
Ingo Weyrich
2021-02-21 13:32:16 +01:00
parent 9e159deb01
commit 24df5166f2

View File

@@ -678,14 +678,17 @@ int ImageIO::getTIFFSampleFormat (const Glib::ustring &fname, IIOSampleFormat &s
return IMIO_VARIANTNOTSUPPORTED;
}
if (!TIFFGetField(in, TIFFTAG_SAMPLEFORMAT, &sampleformat))
if (!TIFFGetField(in, TIFFTAG_SAMPLEFORMAT, &sampleformat)) {
/*
* WARNING: This is a dirty hack!
* We assume that files which doesn't contain the TIFFTAG_SAMPLEFORMAT tag
* (which is the case with uncompressed TIFFs produced by RT!) are RGB files,
* but that may be not true. --- Hombre
*/
{
sampleformat = SAMPLEFORMAT_UINT;
} else if (sampleformat == SAMPLEFORMAT_VOID) {
// according to https://www.awaresystems.be/imaging/tiff/tifftags/sampleformat.html
// we assume SAMPLEFORMAT_UINT if SAMPLEFORMAT_VOID is set
sampleformat = SAMPLEFORMAT_UINT;
}