Commit 6a40f2662 for imagemagick.org
commit 6a40f2662d67df1a8e5689f2adbcbc9c59a43412
Author: Dirk Lemstra <dirk@lemstra.org>
Date: Fri Jul 31 10:08:37 2026 +0200
Fix YCbCr TIFF images to always convert to RGB via the generic reader.
diff --git a/coders/tiff.c b/coders/tiff.c
index 3853fa734..f0d9d22b9 100644
--- a/coders/tiff.c
+++ b/coders/tiff.c
@@ -1455,10 +1455,6 @@ static Image *ReadTIFFImage(const ImageInfo *image_info,
(void) SetImageColorspace(image,CMYKColorspace,exception);
if (photometric == PHOTOMETRIC_CIELAB)
(void) SetImageColorspace(image,LabColorspace,exception);
- if ((photometric == PHOTOMETRIC_YCBCR) &&
- (compress_tag != COMPRESSION_OJPEG) &&
- (compress_tag != COMPRESSION_JPEG))
- (void) SetImageColorspace(image,YCbCrColorspace,exception);
TIFFGetProfiles(tiff,image,exception);
status=TIFFGetProperties(tiff,image,exception);
if (status == MagickFalse)
@@ -1758,6 +1754,7 @@ static Image *ReadTIFFImage(const ImageInfo *image_info,
method=ReadTileMethod;
}
if ((photometric == PHOTOMETRIC_LOGLUV) ||
+ (photometric == PHOTOMETRIC_YCBCR) ||
(compress_tag == COMPRESSION_CCITTFAX3))
method=ReadGenericMethod;
if (image->compression == JPEGCompression)
@@ -1765,8 +1762,7 @@ static Image *ReadTIFFImage(const ImageInfo *image_info,
if (photometric == PHOTOMETRIC_SEPARATED)
method=GetJPEGMethod(image,tiff,bits_per_sample,samples_per_pixel);
else if ((method != ReadStripMethod) ||
- (compress_tag == COMPRESSION_OJPEG) ||
- (photometric == PHOTOMETRIC_YCBCR))
+ (compress_tag == COMPRESSION_OJPEG))
method=ReadGenericMethod;
}
#if defined(WORDS_BIGENDIAN)