Bug 690178 - 1-bit CMYK PDF file not rendered correctly
1-bit CMYK PDF file not rendered correctly
Product: Ghostscript
Classification: Unclassified
Component: PDF Interpreter
PC Linux
: P4 normal
Assigned To: Alex Cherepanov
Bug traffic
Depends on:
  Show dependency treegraph
Reported: 2008-11-21 01:46 PST by Till Kamppeter
Modified: 2008-12-19 08:31 PST (History)
0 users

See Also:
Word Size: ---

1-Bit CMYK PDF file (1.35 KB, application/pdf)
2008-11-21 01:47 PST, Till Kamppeter
Screen shot of file display with Adobe Reader (29.30 KB, image/png)
2008-11-21 01:51 PST, Till Kamppeter
Screen shot of file display with Ghostscript (5.08 KB, image/png)
2008-11-21 01:53 PST, Till Kamppeter
patch (1.97 KB, patch)
2008-11-21 22:00 PST, Alex Cherepanov
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Till Kamppeter 2008-11-21 01:46:07 PST
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 PST
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 PST
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 PST
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 PST
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 PST
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 PST
Created attachment 4618 [details]

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 PST
For me the sample file displays correctly after applying the patch.
Comment 8 Alex Cherepanov 2008-12-05 04:58:24 PST
The patch is committed as a rev. 9254.