From ea6b28632556408e563c4f048de8eaa37298a8d7 Mon Sep 17 00:00:00 2001 From: natureh 510 Date: Wed, 20 Mar 2013 22:16:07 +0100 Subject: [PATCH] Solving issue 1776: "Support for TIFF files with alpha channel (RGBA)" --- rtengine/imageio.cc | 58 ++++++++++++++++++++++----------------------- 1 file changed, 28 insertions(+), 30 deletions(-) diff --git a/rtengine/imageio.cc b/rtengine/imageio.cc index 3dfd23ea6..4f60e8e0f 100644 --- a/rtengine/imageio.cc +++ b/rtengine/imageio.cc @@ -532,43 +532,41 @@ int ImageIO::getTIFFSampleFormat (Glib::ustring fname, IIOSampleFormat &sFormat, TIFFClose(in); - if (samplesperpixel==3) { - if (photometric == PHOTOMETRIC_RGB) { - if (sampleformat==SAMPLEFORMAT_UINT) { - if (bitspersample==8) { - sFormat = IIOSF_UNSIGNED_CHAR; - return IMIO_SUCCESS; - } - if (bitspersample==16) { - sFormat = IIOSF_UNSIGNED_SHORT; - return IMIO_SUCCESS; - } + if (photometric == PHOTOMETRIC_RGB) { + if ((samplesperpixel==3 || samplesperpixel==4) && sampleformat==SAMPLEFORMAT_UINT) { + if (bitspersample==8) { + sFormat = IIOSF_UNSIGNED_CHAR; + return IMIO_SUCCESS; } - else if (sampleformat==SAMPLEFORMAT_IEEEFP) { - /* - * Not yet supported - * - if (bitspersample==16) { - sFormat = IIOSF_HALF; - return IMIO_SUCCESS; - }*/ - if (bitspersample==32) { - sFormat = IIOSF_FLOAT; - return IMIO_SUCCESS; - } + if (bitspersample==16) { + sFormat = IIOSF_UNSIGNED_SHORT; + return IMIO_SUCCESS; } } - else if (photometric == PHOTOMETRIC_LOGLUV) { - if (compression==COMPRESSION_SGILOG24) { - sFormat = IIOSF_LOGLUV24; - return IMIO_SUCCESS; - } - else if (compression==COMPRESSION_SGILOG) { - sFormat = IIOSF_LOGLUV32; + else if (samplesperpixel==3 && sampleformat==SAMPLEFORMAT_IEEEFP) { + /* + * Not yet supported + * + if (bitspersample==16) { + sFormat = IIOSF_HALF; + return IMIO_SUCCESS; + }*/ + if ((samplesperpixel==3 || samplesperpixel==4) && bitspersample==32) { + sFormat = IIOSF_FLOAT; return IMIO_SUCCESS; } } } + else if (samplesperpixel==3 && photometric == PHOTOMETRIC_LOGLUV) { + if (compression==COMPRESSION_SGILOG24) { + sFormat = IIOSF_LOGLUV24; + return IMIO_SUCCESS; + } + else if (compression==COMPRESSION_SGILOG) { + sFormat = IIOSF_LOGLUV32; + return IMIO_SUCCESS; + } + } return IMIO_VARIANTNOTSUPPORTED; }