[OS X TeX] eps2pdf and grayscale eps?

Siep Kroonenberg siepo at cybercomm.nl
Wed Apr 25 10:09:53 CEST 2007


On Tue, Apr 24, 2007 at 09:06:09PM +0200, Daniel Becker wrote:
> Hallo,
> 
> I have \usepackage{eps2pdf} in my preamble to use .eps-Graphics with  
> pdflatex (they are produced by Stata. Is there an option like  
> \usepackage[NOCOLOURS]{eps2pdf} or so such that the final pdf does  
> not contain any colour information?
> 
> I need that to prepare the pdf for the printing press....
> 
> Google and so on didn't help (me).
> 
> Thanks for hints
> 
> daniel
> 
> ------------------------- Helpful Info -------------------------
> Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
> TeX FAQ: http://www.tex.ac.uk/faq
> List Archive: http://tug.org/pipermail/macostex-archives/
> List Reminders & Etiquette: http://www.esm.psu.edu/mac-tex/list/

Epspdf, also available from ctan, offers conversion to grayscale,
although it doesn't always work, depending in the existence of color
bitmapped images and the color model(s) used.

The trick is to prepend some PostScript code to the eps file which
redefines all rbg and cmyk colors as gray. This is the PostScript
header file used by epspdf:

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%!
% makegray.pro, PostScript header file for grayscale conversion.

%%%%<< /ProcessColorModel /DeviceGray >> setpagedevice
userdict begin
% .11*B + .59*G + .3*R
/setrgbcolor {
  0.11 mul exch 0.59 mul add exch 0.3 mul add
  systemdict begin setgray end
} def
% 1.0 - min(1.0, .3*C + .59*M + .11*Y + B)
/setcmykcolor {
  exch 0.11 mul add
  exch 0.59 mul add
  exch 0.3 mul add
  dup 1 gt {pop 1} if
  1 exch sub
  systemdict begin setgray end
} def
end

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

The result is not a valid eps, but converting to pdf and back takes
care of that. Epspdf does the necessary conversions behind the
scenes.

Professional graphics programs nowadays often use advanced color
models which aren't addressed by this header file. It doesn't handle
bitmaps either. It should work ok with most office- and science
graphics.

-- 
Siep Kroonenberg

------------------------- Helpful Info -------------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
TeX FAQ: http://www.tex.ac.uk/faq
List Archive: http://tug.org/pipermail/macostex-archives/
List Reminders & Etiquette: http://www.esm.psu.edu/mac-tex/list/





More information about the macostex-archives mailing list