3

I'm trying to do it using Ghostscript:

gs -sOutputFile=gray.pdf           \
   -sDEVICE=pdfwrite               \
   -sColorConversionStrategy=Gray  \
   -dProcessColorModel=/DeviceGray \
   -dNOPAUSE -dBATCH               \
   -dAutoRotatePages=/None         \
    color.pdf

But this doesn't result in using only black ink:

gs -q  -o - -sDEVICE=inkcov gray.pdf

 0.15365  0.15365  0.15365  0.09419 CMYK OK

I can make the conversion successfully using Adobe products but I'd like to be able to do this in a more automatable fashion.

Kurt Pfeifle
  • 86,724
  • 23
  • 248
  • 345
Ian Goodfellow
  • 2,584
  • 2
  • 19
  • 20
  • What version of Ghostscript are you using and on which platform ? It looks like Linux, so the next question is did you compile it yourself from our sources, or use a packaged version ? Where is a copy of 'color.pdf' so that we can examine the file ? – KenS Apr 25 '15 at 08:35
  • I've had the same problem on both Ubuntu and Mac OS X, using ghostscript installed from the package manager in both cases. It also happens with several different files. – Ian Goodfellow Apr 25 '15 at 16:18
  • Here's an example of one file: https://drive.google.com/file/d/0B64011x02sIkUHp6TWctRlZSbTQ/view?usp=sharing – Ian Goodfellow Apr 25 '15 at 16:22
  • This is due to the way that inkcov works. Your PDF file contains a transparency group with a DeviceRGB blending space. Note that this does not actually create any RGB output, it merely means that any objects which are blended must be done in RGB space. Because inkcov is a CMYK device, this means that the blended RGB objects must then be converted to CMYK. This results in less than perfect black. The PDF file does not in fact contain anything except gray colour specifications *except* for specifying the blending space of the transparency as RGB. – KenS Apr 25 '15 at 20:02
  • Its not at all clear to me what we should do about this, its one of the things I'm thnking about for the next release. – KenS Apr 25 '15 at 20:02
  • @KenS: It would be nice if you added your comment as an answer. (Or add at least a dummy answer in your name -- I'll edit in the contents, if you don't have enough time. So the +reput credit still goes to you :) – Kurt Pfeifle Apr 26 '15 at 15:14
  • Well, I'm not so worried about it, but well, here goes. I've added slightly more content also – KenS Apr 26 '15 at 19:44

1 Answers1

1

This is (mostly) due to the way that inkcov works.

Your PDF file contains a transparency group with a DeviceRGB blending space. Note that this does not actually create any RGB output, it merely means that any objects which are blended must be done in RGB space. So anything not in DeviceRGB (eg all the objects in Gray) must first be converted to RGB, then blended, then converted to device space for rendering.

Because inkcov is a CMYK device, this means that the blended RGB objects must then be converted to CMYK. This results in less than perfect black. The PDF file does not in fact contain anything except gray colour specifications except for specifying the blending space of the transparency as RGB.

Looking at what Acrobat appears to do, it seems the simple solution is the one to go for, change the transparency blending space into DeviceGray as well. We know from previous experience that blending in different spaces does result in differences in rendering. On the other hand, so does changing the colour space of all the colour specifications......

Given time to do some more investigation I'll probably go down ths road in the next release.

KenS
  • 30,202
  • 3
  • 34
  • 51
  • I'm not totally sure I understand the answer. Are you saying that I have converted the PDF to use only black ink successfully, but that my method of using inkcov to test if it uses only black ink is incorrect? If so, what method of testing for only black ink should I use? – Ian Goodfellow Apr 28 '15 at 17:02
  • IT depends on what you regard as 'converted'. There are no colour specifications in the file which are not in device gray, however, the file uses transparency, and the blending space for the transparency is left as DeviceRGB. This means that anything drawn in that group is first converted to RGB, blended, then converted back to the device space. Because inkcov is CMYK, that conversion results in colours other than black. You can't 'test only for black ink' since the ink usage depends on the output device. You can only look at the colour values in the PDF file. – KenS Apr 29 '15 at 06:53