* 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>
This commit is contained in:
Lee Howard 2010-12-14 23:58:39 +00:00
parent 1e3630f9fd
commit 7a01aa5d24
2 changed files with 16 additions and 3 deletions

View File

@ -1,3 +1,9 @@
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> 2010-12-13 Lee Howard <faxguy@howardsilvan.com>
* tools/fax2ps.c: be consistent with page-numbering * tools/fax2ps.c: be consistent with page-numbering

View File

@ -1,4 +1,4 @@
/* $Id: tif_jpeg.c,v 1.95 2010-12-12 01:55:00 faxguy Exp $ */ /* $Id: tif_jpeg.c,v 1.96 2010-12-14 23:58:39 faxguy Exp $ */
/* /*
* Copyright (c) 1994-1997 Sam Leffler * Copyright (c) 1994-1997 Sam Leffler
@ -1701,8 +1701,15 @@ JPEGPreEncode(TIFF* tif, uint16 s)
sp->cinfo.c.comp_info[0].h_samp_factor = sp->h_sampling; sp->cinfo.c.comp_info[0].h_samp_factor = sp->h_sampling;
sp->cinfo.c.comp_info[0].v_samp_factor = sp->v_sampling; sp->cinfo.c.comp_info[0].v_samp_factor = sp->v_sampling;
} else { } else {
sp->cinfo.c.in_color_space = JCS_UNKNOWN; if (td->td_photometric == PHOTOMETRIC_MINISWHITE || td->td_photometric == PHOTOMETRIC_MINISBLACK)
if (!TIFFjpeg_set_colorspace(sp, JCS_UNKNOWN)) 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); return (0);
/* jpeg_set_colorspace set all sampling factors to 1 */ /* jpeg_set_colorspace set all sampling factors to 1 */
} }