We have an EPS file with a logo in one color. Is it possible to somehow manipulate this color from within LaTeX? We need this logo in different colors for different series of one imprint.


This is the logo:


  • 1
    It's probably easier to manually edit the postscript code, or do it using sed. Can you make it available for download? Jun 14, 2013 at 20:27
  • Stephan, Could you place the image in a long-term storage? The link above no longer works. Nov 27, 2020 at 17:38

2 Answers 2


There is a trick with the graphics driver file pdftex.def for pdfTeX in PDF mode. If the PDF image does not contain color settings, then pdftex.def does not enforce black, but uses the current color.

  1. First we need to convert the EPS file to PDF:

    ps2pdf -dEPSCrop -dCompressPages=false Logo_Buchcover_hellblau.eps Logo_Buchcover.pdf

    Option -dCompressPages=false disables the compression for the page contents, because we need to manipulate it in the next step. Because the image does not contain many operators, there is no much gain in compressing anyway.

  2. The color setting needs to be disabled. However care is needed. PDF records the positions of its indirect objects in a cross reference table, we only change a byte and do not add or remove bytes to keep the PDF structures intact.

    Identify the line:

    0.599609 0.0499878 0.0499878 0 k

    k is the operator for setting a CMYK color. The percent % is the comment character in PDF (PostScript, TeX), thus we change the first 0 to %:

    %.599609 0.0499878 0.0499878 0 k

    The editor that is used to modify the byte must not change anything else (line ends, tabulators, ...). If in doubt, then also a hex editor will do.

  3. Now we can use the image in pdfLaTeX:

    % The trick does not work for other drivers



enter image description here

This might not work with any eps, but for not very complex vector graphics, this workflow can be used:

  • convert Logob.eps to Asymptote with pstoedit -f asy Logob.eps Logob.asy;
  • simplify asy code and add commands to change color where appropriate.

For the logo provided pstoedit found that DIN-Regular font is used for the text.

Following Logob.tex contains a procedure to draw the logo in asydef, which accepts parameters for the background color, colors of the books and colors of the three lines of text.

import pstoedit;
void logo(pen bgPen=white,pen[] bookPen=new pen[]{black}, pen[] textPen=bookPen){
  textpen += fontsize(7.84581);


  textpen += fontsize(8.02011);


  textpen += fontsize(8.02011);

  currentpen += 0.5bp;
  currentpen += squarecap;
  currentpen += miterjoin;
  currentpen += linetype(" ",false);

logo(bgPen=gray,bookPen=new pen[]{white},textPen=new pen[]{black});
logo(bgPen=lightblue+opacity(0.3),bookPen=new pen[]{green,orange});
logo(bgPen=lightgreen+opacity(0.3),bookPen=new pen[]{red,green,darkblue,orange,yellow}
  ,textPen=new pen[]{red,green,blue});

To process it with xelatex, run:

xelatex Logob.tex
asy -f pdf -tex=xelatex Logob-*.asy
xelatex Logob.tex
  • At first this might get difficult, but in the end this is a brilliant idea! Thanks a lot! :)
    – user101590
    May 7, 2016 at 6:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .