From 10f8b87fb2da106e7121b3e4d16519e7ac8f7621 Mon Sep 17 00:00:00 2001 From: L Peter Deutsch Date: Thu, 12 Jul 2001 05:47:07 +0000 Subject: Fix: pdfwrite didn't write transfer functions in the output for images, and allowed lossy compressions on images even in the presence of peculiar transfer functions (such as functions simulating indexed color spaces). This fix writes transfer functions for images, prevents lossy compression if the transfer function is not the identity, and undoes the hack that was implemented earlier to work around this problem. Fixes SourceForge bug #420257. git-svn-id: http://svn.ghostscript.com/ghostscript/trunk@1595 a1074d23-0009-0410-80fe-cf8c14f379e6 --- gs/src/gdevpdfi.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'gs/src/gdevpdfi.c') diff --git a/gs/src/gdevpdfi.c b/gs/src/gdevpdfi.c index 5997a1a58..a0b199fef 100644 --- a/gs/src/gdevpdfi.c +++ b/gs/src/gdevpdfi.c @@ -297,10 +297,22 @@ pdf_begin_typed_image(gx_device_pdf *pdev, const gs_imager_state * pis, } if ((code = pdf_begin_write_image(pdev, &pie->writer, gs_no_id, width, height, NULL, in_line)) < 0 || - /****** pctm IS WRONG ******/ - (code = psdf_setup_image_filters((gx_device_psdf *) pdev, - &pie->writer.binary, &image.pixel, - pmat, pis)) < 0 || + /* + * Some regrettable PostScript code (such as LanguageLevel 1 output + * from Microsoft's PSCRIPT.DLL driver) misuses the transfer + * function to accomplish the equivalent of indexed color. + * Downsampling (well, only averaging) or JPEG compression are not + * compatible with this. Play it safe by using only lossless + * filters if the transfer function(s) is/are other than the + * identity. + */ + (code = (pdev->transfer_not_identity ? + psdf_setup_lossless_filters((gx_device_psdf *) pdev, + &pie->writer.binary, + &image.pixel) : + psdf_setup_image_filters((gx_device_psdf *) pdev, + &pie->writer.binary, &image.pixel, + pmat, pis))) < 0 || (code = pdf_begin_image_data(pdev, &pie->writer, (const gs_pixel_image_t *)&image, &cs_value)) < 0 -- cgit v1.2.1