diff options
author | faxguy <faxguy> | 2010-12-14 23:59:42 +0000 |
---|---|---|
committer | faxguy <faxguy> | 2010-12-14 23:59:42 +0000 |
commit | 800e064b5e523c9e2438d85d30862d2cd4b6d25b (patch) | |
tree | 41375b6f5c0e8fbcaaecec35edfeee1dfcf267f3 | |
parent | 37cd4977418fec69636c2b36ad430c3c0169f72f (diff) | |
download | libtiff-800e064b5e523c9e2438d85d30862d2cd4b6d25b.tar.gz |
* libtiff/tif_jpeg.c: reduce usage of JCS_UNKNOWN in order
to improve compatibility with various viewers
submitted by e-mail from Dwight Kelly <dkelly@apago.com>
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | libtiff/tif_jpeg.c | 13 |
2 files changed, 16 insertions, 3 deletions
@@ -1,5 +1,11 @@ 2010-12-13 Lee Howard <faxguy@howardsilvan.com> + * libtiff/tif_jpeg.c: reduce usage of JCS_UNKNOWN in order + to improve compatibility with various viewers + submitted by e-mail from Dwight Kelly <dkelly@apago.com> + +2010-12-13 Lee Howard <faxguy@howardsilvan.com> + * tools/fax2ps.c: be consistent with page-numbering http://bugzilla.maptools.org/show_bug.cgi?id=2225 diff --git a/libtiff/tif_jpeg.c b/libtiff/tif_jpeg.c index 69691f98..051eba1b 100644 --- a/libtiff/tif_jpeg.c +++ b/libtiff/tif_jpeg.c @@ -1,4 +1,4 @@ -/* $Id: tif_jpeg.c,v 1.50.2.14 2010-12-12 01:57:24 faxguy Exp $ */ +/* $Id: tif_jpeg.c,v 1.50.2.15 2010-12-14 23:59:42 faxguy Exp $ */ /* * Copyright (c) 1994-1997 Sam Leffler @@ -1358,8 +1358,15 @@ JPEGPreEncode(TIFF* tif, tsample_t s) sp->cinfo.c.comp_info[0].h_samp_factor = sp->h_sampling; sp->cinfo.c.comp_info[0].v_samp_factor = sp->v_sampling; } else { - sp->cinfo.c.in_color_space = JCS_UNKNOWN; - if (!TIFFjpeg_set_colorspace(sp, JCS_UNKNOWN)) + if (td->td_photometric == PHOTOMETRIC_MINISWHITE || td->td_photometric == PHOTOMETRIC_MINISBLACK) + sp->cinfo.c.in_color_space = JCS_GRAYSCALE; + else if (td->td_photometric == PHOTOMETRIC_RGB) + sp->cinfo.c.in_color_space = JCS_RGB; + else if (td->td_photometric == PHOTOMETRIC_SEPARATED && td->td_samplesperpixel == 4) + sp->cinfo.c.in_color_space = JCS_CMYK; + else + sp->cinfo.c.in_color_space = JCS_UNKNOWN; + if (!TIFFjpeg_set_colorspace(sp, (sp->cinfo.c.in_color_space == JCS_RGB) ? JCS_YCbCr : sp->cinfo.c.in_color_space)) return (0); /* jpeg_set_colorspace set all sampling factors to 1 */ } |