From: Cristy Date: Thu, 2 Mar 2017 02:08:21 +0000 (-0500) Subject: Ensure enough samples for RGB or CMYK TIFF images with an alpha channel X-Git-Tag: 7.0.5-1~8 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e818875e84d90e85c2e4803ef5169a3d0f3adb8f;p=imagemagick Ensure enough samples for RGB or CMYK TIFF images with an alpha channel --- diff --git a/coders/tiff.c b/coders/tiff.c index b1a9f9618..edb576343 100644 --- a/coders/tiff.c +++ b/coders/tiff.c @@ -1591,9 +1591,13 @@ RestoreMSCWarning (void) SetImageProperty(image,"tiff:rows-per-strip",value,exception); } if ((samples_per_pixel >= 3) && (interlace == PLANARCONFIG_CONTIG)) - method=ReadRGBAMethod; + if ((image->alpha_trait == UndefinedPixelTrait) || + (samples_per_pixel >= 4)) + method=ReadRGBAMethod; if ((samples_per_pixel >= 4) && (interlace == PLANARCONFIG_SEPARATE)) - method=ReadCMYKAMethod; + if ((image->alpha_trait == UndefinedPixelTrait) || + (samples_per_pixel >= 5)) + method=ReadCMYKAMethod; if ((photometric != PHOTOMETRIC_RGB) && (photometric != PHOTOMETRIC_CIELAB) && (photometric != PHOTOMETRIC_SEPARATED))