Wednesday, November 4, 2009

Resizing EPS files

Sometimes an eps file from my favourite plotting device (gnuplot, matlab, mathematica) is just to big for the arxiv and a png or jpeg file produced directly from the plotting device is just useless; in my experience the lettering produced like this pixelize most of the time.

I have tried different methods to produce nice and small figure files. So far, when an image files is just too big even for a journal submission I do the following,

  1. Arxiv, convert the nice looking eps into a png and use the png for submission. Pdflatex can handle png files.

    gs -r300 -dEPSCrop -dTextAlphaBits=4 -sDEVICE=png16m -sOutputFile=output.png -dBatch -dNOPAUSE input.eps

  2. Journal, try to rezise the nice looking eps. I take the output of the aforementioned code

    convert -quality=100 input.png output.jpg
    convert input.jpg esp2:output.eps

These are modifications on the solutions posted by Luke at Terminally-Incoherent, the Four Forces, the gs manual and the imagemagick manual. It seems png -> eps2 fails that's why png->eps3 or jpg->eps2 has to be used, it seems quite an old problem. I prefer jpg->eps2 as it produces smaller files than png->eps3 does.

If you have a better solution I'm eager to read about that.

NOTE: I found almost the same solution with a great discussion on the topic here.

UPDATE (March 23rd, 2010): I've started using GIMP to parse EPS files into smaller EPS files and PNG files, it seems the best alternative so far without the hassle of keeping gs and convert commands in my memory.

No comments:

Post a Comment