[cairo] Creating CMYK and spot colors using Postscript backend

Markus Meyer meyer at mesw.de
Sun May 13 12:45:18 PDT 2007


Behdad Esfahbod schrieb:
> I am a cairo developer (and maintainer), yes.
> Please provide that information, we will see who implements it first!
>   
Attached are three EPS files which show how EPS color implementation
differs when RGB, CMYK and spot colors are used. They each show a red
and a green line in different color spaces. You technically can use any
alternative color for spot colors, but in practice, only CMYK matters
because spot colors are used for printing (which normally uses CMYK).

The recipe to implement the different color spaces is as follows:

To select a RGB color in Postscript, use this command:

<R> <G> <B> setrgbcolor

here <R>, <G>, <B> are the components of the color in the interval [0,1]

To select a CMYK color in Postscript, use this command:

<C> <M> <Y> <K> setcmykcolor

where <C>, <M>, <Y>, <K> are the components of the color in the interval
[0,1]

To select a spot color in Postscript Level II, use these commands:

[/Separation
 (<NAME OF THE SPOT COLOR>)
 /DeviceCMYK
 {
  dup <C> mul exch
  dup <M> mul exch
  dup <Y> mul exch
  <K> mul
 }
] setcolorspace
<TINT> setcolor

where <NAME OF THE SPOT COLOR> is the spot color's arbitrary name
string, <C>, <M>, <Y>, <K> are the components of the color in the
interval [0,1] and <TINT> is a number between [0,1] is the tint of the
color (1 means full tint, 0 means no tint, I pretty much always use full
tint).

Additionally, for the "/Separation" command to work in EPS files, some
header comments must be added like this:

%%DocumentProcessColors: Cyan Magenta Yellow Black
%%DocumentCustomColors: (<NAME OF FIRST SPOT COLOR>) (<NAME OF SECOND
SPOT COLOR>) etc.
%%CMYKCustomColor: <C> <M> <Y> <K> (<NAME OF FIRST SPOT COLOR>)
%%+ <C> <M> <Y> <K> (<NAME OF SECOND SPOT COLOR>)
etc.

This is all that is to it.


Markus

-------------- next part --------------
A non-text attachment was scrubbed...
Name: red_green_cmyk.eps
Type: application/postscript
Size: 435 bytes
Desc: not available
Url : http://cairographics.org/archives/cairo/attachments/20070513/3f252960/attachment.eps 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: red_green_rgb.eps
Type: application/postscript
Size: 428 bytes
Desc: not available
Url : http://cairographics.org/archives/cairo/attachments/20070513/3f252960/attachment-0001.eps 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: red_green_spot.eps
Type: application/postscript
Size: 825 bytes
Desc: not available
Url : http://cairographics.org/archives/cairo/attachments/20070513/3f252960/attachment-0002.eps 


More information about the cairo mailing list