From ab567929dbbb62237e4598f9c1b6a8231431305c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20B=C3=BCnzli?= Date: Wed, 25 Sep 2013 15:47:32 +0200 Subject: don't color transform RGB JPEG-in-TIFF images TIFF images containing JPEG data only require color transformation for CYMK data streams. For RGB streams, this could lead to unexpected results. --- source/fitz/load-tiff.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'source/fitz/load-tiff.c') diff --git a/source/fitz/load-tiff.c b/source/fitz/load-tiff.c index f473802b..2850e278 100644 --- a/source/fitz/load-tiff.c +++ b/source/fitz/load-tiff.c @@ -188,9 +188,12 @@ fz_decode_tiff_jpeg(struct tiff *tiff, fz_stream *chain, unsigned char *wp, int { fz_stream *stm; fz_stream *jpegtables = NULL; + int color_transform = -1; /* unset */ if (tiff->jpegtables && (int)tiff->jpegtableslen > 0) jpegtables = fz_open_memory(tiff->ctx, tiff->jpegtables, (int)tiff->jpegtableslen); - stm = fz_open_dctd(chain, -1, 0, jpegtables); + if (tiff->photometric == 2 /* RGB */ || tiff->photometric == 3 /* RGBPal */) + color_transform = 0; + stm = fz_open_dctd(chain, color_transform, 0, jpegtables); fz_read(stm, wp, wlen); fz_close(stm); } -- cgit v1.2.3