[gs-commits] ghostpdl branch, master, updated. jbig2dec-0.14-1613-g5d10fde
[email protected] (Ken Sharp)
| Newsgroups | gmane.comp.printing.ghostscript.cvs |
|---|---|
| Message-ID | <[email protected]> |
The ghostpdl branch, master has been updated
via 5d10fde23ccd74c2721e4870c5914fe7373a7816 (commit)
from 02c252f00e7bbc9a9a23d0a0996e88ba1839f127 (commit)
----------------------------------------------------------------------
commit 5d10fde23ccd74c2721e4870c5914fe7373a7816
Author: Ken Sharp <[email protected]>
Date: Tue Aug 27 15:27:05 2019 +0100
pdfwrite - fix corner case with Color Conversion
Bug #701456 "Ghostscript creates broken PDF file after color conversion"
The test file is, essentially weird. The image on page 3 is not a single
image, its a series of images, all of which are in a /Indexed /DeviceRGB
colour space.
In addition, these images are drawn on *top* of another set of images
(thereby completely obscuring them). These images are also drawn in
/Indexed /DeviceRGB. However, these images are in fact monochrome, the
Indexed space consists of 2 colours. This means that (highly unusually)
we have a DeviceRGB image with 1 Bit Per Component.
This caused problems for the pdfwrite compression filter chooser because
it chose (and configured) a compression scheme suitable for 1 BPC data
and then actually output 8 BPC data. This led to the compression filter
writing too little data.
Fix this here by setting the BPC to 8 if we are doing colour conversion,
and have the colour conversion setup code use the original value in the
image enumerator (the conversion code *does* need to know the input is
1 BPC).
diff --git a/devices/vector/gdevpdfi.c b/devices/vector/gdevpdfi.c
index d095622..fed96e4 100644
--- a/devices/vector/gdevpdfi.c
+++ b/devices/vector/gdevpdfi.c
@@ -1367,6 +1367,7 @@ pdf_begin_typed_image(gx_device_pdf *pdev, const gs_gstate * pgs,
if (code < 0)
goto fail_and_fallback;
image[0].pixel.ColorSpace = pcs_device;
+ image[0].pixel.BitsPerComponent = 8;
code = pdf_color_space_named(pdev, pgs, &cs_value, &pranges, pcs_device, names,
in_line, NULL, 0, false);
if (code < 0)
@@ -1508,6 +1509,7 @@ pdf_begin_typed_image(gx_device_pdf *pdev, const gs_gstate * pgs,
if (convert_to_process_colors) {
image[0].pixel.ColorSpace = pcs_orig;
+ image[0].pixel.BitsPerComponent = pim->BitsPerComponent;
code = psdf_setup_image_colors_filter(&pie->writer.binary[0],
(gx_device_psdf *)pdev, &image[0].pixel, pgs);
if (code < 0)
Summary of changes:
devices/vector/gdevpdfi.c | 2 ++
1 file changed, 2 insertions(+)