From 24df5166f2ce7e2c75861511a2791e4b429c4ff6 Mon Sep 17 00:00:00 2001 From: Ingo Weyrich Date: Sun, 21 Feb 2021 13:32:16 +0100 Subject: [PATCH] assume SAMPLEFORMAT_UINT for tiff files when SAMPLEFORMAT_VOID is set --- rtengine/imageio.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/rtengine/imageio.cc b/rtengine/imageio.cc index 102d53b8e..971f7c9e9 100644 --- a/rtengine/imageio.cc +++ b/rtengine/imageio.cc @@ -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; }