Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.postscript > #242
| From | ken <ken@spamcop.net> |
|---|---|
| Newsgroups | comp.lang.postscript |
| Subject | Re: PDF to PDF (gs?): rich RGB black to plain K (CMYK) black? |
| Date | 2011-06-07 10:21 +0100 |
| Message-ID | <MPG.2857fdd2309a7c4c989846@usenet.plus.net> (permalink) |
| References | <208ecf3d-3629-4672-9a3e-135e44701d6b@p13g2000yqh.googlegroups.com> <MPG.28568d9998586243989843@usenet.plus.net> <6d0f8a6c-3430-4b2f-8852-ddb0e772e4ac@v8g2000yqb.googlegroups.com> |
In article <6d0f8a6c-3430-4b2f-8852-
ddb0e772e4ac@v8g2000yqb.googlegroups.com>, sd@imi.aau.dk says...
> > Its also possible to set up an under colour removal function which
> > significantly affects how RGB is converted to CMYK (this is covered in
> > the PostScript Language Reference Manual).
> >
>
> Thanks for noting this - I was somewhat aware that postscript language
> can also "process", but I am completely ignorant about its scope. Re:
> the DeviceGray CMYK workflow, I was intuitively trying to follow that
> in the above "monster" cmdline too (as in: force all colors to
> grayscale during conversion [in conversion colorspace], and write out
> CMYK values based on these grayscale ones, which hopefully end up only
> on the K plate) -- but I couldn't get `tiffsep` to confirm that.
>
>
> > If you can post a (small!) example file, preferably a single page, to
> > some publicly accessible URL I could take a look.
> >
>
> Sure, here are the pdf's of the slides mentioned in the OP:
>
> http://sdaaubckp.sf.net/post/img/blah-slide.pdf
> http://sdaaubckp.sf.net/post/img/blah-slideP.pdf
I wasn't able to do this conversion in a single pass using the
Ghostscript PDF interpreter, because it uses the setrgbcolor directly
from systemdict, so it doesn't allow for replacement.
Instead I first converted your files to PostScript using the ps2write
device:
gs -sDEVICE=ps2write -sOutputFile=./out.ps ./blah-slide.pdf
Then I created a simple replaement routine, and stored it in a file
called HackRGB.ps:
%!
/oldsetrgbcolor /setrgbcolor load def
/setrgbcolor {
(in replacement setrgbcolor\n) print
%% R G B
1 index 1 index %% R G B G B
eq { %%
2 index 1 index %% R G B R B
eq {
%% Here if R = G = B
pop pop %% remove two values
setgray
} {
oldsetrgbcolor %% set the RGB values
} ifelse
}{
oldsetrgbcolor %% Set the RGB values
}ifelse
} bind def
This replaces the setrgbcolor operator with a routine which tests the
RGB value and if all components are equal it replaces it with a call to
setgray using just one of the components. (BTW you can remove the line
ending in 'print', its just there so that you can see something is
happening ;-)
I then converted the PostScript file back to PDF, but using this code:
gs -sDEVICE=pdfwrite -sOutputFile=./out.pdf ./HackRGB.ps ./out.ps
This results in a PDF file where the text is in a shade of gray. This
*ought* to be acceptable to your print shop, because gray should map
straight to the K channel of CMYK.
If for some reason that isn't acceptable, you could replace the
'setgray' with '0 0 0 4 -1 roll setcmykcolor' which uses CMYK directly.
NOTE! This only affects linework (text, vectors), only affects linework
using RGB and will only ocnvert that to gray if the R, G and B values
are identical. Images, shadings and potentially other object types will
not be affected.
I should also mention that going from PDF to PostScript and back to PDF
is a potentially lossy process which can introduce errors and odd
artefacts, you should check files carefully after this conversion. I
haven't tested this code particularly.
If you print directly to PostScript then you can eliminate one
conversion step, which is probably worthwhile.
Ken
Back to comp.lang.postscript | Previous | Next — Previous in thread | Next in thread | Find similar
PDF to PDF (gs?): rich RGB black to plain K (CMYK) black? sdaau <sd@imi.aau.dk> - 2011-06-05 22:49 -0700
Re: PDF to PDF (gs?): rich RGB black to plain K (CMYK) black? Matti Vuori <xmvuori@kolumbus.fi> - 2011-06-06 08:41 +0000
Re: PDF to PDF (gs?): rich RGB black to plain K (CMYK) black? Helge Blischke <h.blischke@acm.org> - 2011-06-06 11:26 +0200
Re: PDF to PDF (gs?): rich RGB black to plain K (CMYK) black? sdaau <sd@imi.aau.dk> - 2011-06-06 04:29 -0700
Re: PDF to PDF (gs?): rich RGB black to plain K (CMYK) black? ken <ken@spamcop.net> - 2011-06-06 14:05 +0100
Re: PDF to PDF (gs?): rich RGB black to plain K (CMYK) black? sdaau <sd@imi.aau.dk> - 2011-06-06 08:34 -0700
Re: PDF to PDF (gs?): rich RGB black to plain K (CMYK) black? ken <ken@spamcop.net> - 2011-06-06 17:28 +0100
Re: PDF to PDF (gs?): rich RGB black to plain K (CMYK) black? ken <ken@spamcop.net> - 2011-06-07 10:21 +0100
Re: PDF to PDF (gs?): rich RGB black to plain K (CMYK) black? sdaau <sd@imi.aau.dk> - 2011-06-09 05:28 -0700
Re: PDF to PDF (gs?): rich RGB black to plain K (CMYK) black? ken <ken@spamcop.net> - 2011-06-09 14:00 +0100
Re: PDF to PDF (gs?): rich RGB black to plain K (CMYK) black? sdaau <sd@imi.aau.dk> - 2011-06-09 06:48 -0700
Re: PDF to PDF (gs?): rich RGB black to plain K (CMYK) black? ken <ken@spamcop.net> - 2011-06-09 16:06 +0100
Re: PDF to PDF (gs?): rich RGB black to plain K (CMYK) black? tlvp <mPiOsUcB.EtLlLvEp@att.net> - 2011-09-16 18:33 -0400
Re: PDF to PDF (gs?): rich RGB black to plain K (CMYK) black? sdaau <sd@imi.aau.dk> - 2011-06-06 09:17 -0700
Re: PDF to PDF (gs?): rich RGB black to plain K (CMYK) black? Helge Blischke <h.blischke@acm.org> - 2011-06-06 19:30 +0200
Re: PDF to PDF (gs?): rich RGB black to plain K (CMYK) black? ole.hoppe@gmail.com - 2012-01-25 06:40 -0800
Re: PDF to PDF (gs?): rich RGB black to plain K (CMYK) black? Helge Blischke <h.blischke@acm.org> - 2012-01-25 16:09 +0100
Re: PDF to PDF (gs?): rich RGB black to plain K (CMYK) black? ole.hoppe@gmail.com - 2012-01-26 06:41 -0800
Re: PDF to PDF (gs?): rich RGB black to plain K (CMYK) black? Helge Blischke <h.blischke@acm.org> - 2012-01-26 21:07 +0100
Re: PDF to PDF (gs?): rich RGB black to plain K (CMYK) black? ole.hoppe@gmail.com - 2012-01-26 12:57 -0800
Re: PDF to PDF (gs?): rich RGB black to plain K (CMYK) black? ole.hoppe@gmail.com - 2012-01-26 12:58 -0800
csiph-web