Bug 690178

Summary: 1-bit CMYK PDF file not rendered correctly
Product: Ghostscript Reporter: Till Kamppeter <till.kamppeter>
Component: PDF InterpreterAssignee: Alex Cherepanov <alex>
Status: NOTIFIED FIXED    
Severity: normal    
Priority: P4    
Version: 8.63   
Hardware: PC   
OS: Linux   
Customer: Word Size: ---
Attachments: 1-Bit CMYK PDF file
Screen shot of file display with Adobe Reader
Screen shot of file display with Ghostscript
patch

Description Till Kamppeter 2008-11-21 01:46:07 UTC
The attached PDF file (which seems to be 1-bit CMYK according to its name) does
not render correctly with Ghostscript. Adobe Reader displays the file correctly.

See the attached screenshots.
Comment 1 Till Kamppeter 2008-11-21 01:47:40 UTC
Created attachment 4612 [details]
1-Bit CMYK PDF file

The PDF which does not render correctly
Comment 2 Till Kamppeter 2008-11-21 01:51:42 UTC
Created attachment 4613 [details]
Screen shot of file display with Adobe Reader

This is how the file should look like
Comment 3 Till Kamppeter 2008-11-21 01:53:08 UTC
Created attachment 4614 [details]
Screen shot of file display with Ghostscript

This is what Ghostscript makes out of the file
Comment 4 Ken Sharp 2008-11-21 02:14:46 UTC
The PDF file contains an image, with a really unusual Decode array:

[0 1 1 0 0 0 0 0]

This eliminates Yellow and Black by mapping all values to 0, inverts Magenta,
and preserves Cyan.

The image is actually (sort of) monochrome. Each sample is either 0 (no inks) or
0xf (all inks, 1-bit per component, 4 components). The Decode array suppresses
the yellow and black components. Where the values are 0, cyan is preserved, and
therefore comes out 0, magenta is inverted, so comes out 100% magenta. Where the
image sample is 0xf the cyan is preserved (100%) and the magenta is inverted to 0%.

If I alter the values in the Decode array to a more normal [0 1 0 1 0 1 0 1]
then the image renders as expected, so it looks like its the odd Decode array
causing the problem. It seems to be the inversion of the samples, non inverting
Decode arrays all seem OK.
Comment 5 Till Kamppeter 2008-11-21 02:35:14 UTC
As Adobe Reader is capable of rendering this file, Ghostscript should be capable
of doing so, too.
Comment 6 Alex Cherepanov 2008-11-21 22:00:41 UTC
Created attachment 4618 [details]
patch

Check the whole Decode array to detect special cases of identity and
inverse decoding.

Regression testing shows no differences.
Comment 7 Till Kamppeter 2008-11-25 09:38:21 UTC
For me the sample file displays correctly after applying the patch.
Comment 8 Alex Cherepanov 2008-12-05 04:58:24 UTC
The patch is committed as a rev. 9254.