Converting an SVG to EPS


Encapsulated PostScript (EPS) is the standard graphics format for many journals.   Having just converted my figures to EPS, I want to share what I’ve learned.  The short version: while at first the results look dreadful, with a little work, Scalable Vector Graphics (SVG) images can be converted into decent looking EPS files.

The reason you might have SVG figures in the first place is that you are using Inkscape rather than Adobe Illustrator (AI) to develop them. Unlike AI, Inkscape is unencumbered by Adobe software licensing restrictions, and you can use it on any mainstream operating system.  It uses SVG format to store vector images, so if you are developing figures in Inkscape, you will eventually need to convert them to EPS format. For AI, this is less of a problem, because AI format is apparently a close cousin to EPS.

Variations on a Naïve Approach

The naïve approach is to export an EPS figure directly from Inkscape.  For all but the simplest images, this doesn’t work. The result of this export is an image that mixes vector and rasterized components seemingly at random.  This produces truly bizarre and ugly results.  Some variations on the naïve approach that work equally well are: opening the SVG in Illustrator, copying and pasting from Inkscape to Illustrator, and saving as a Windows Metafile to open in Illustrator.  To be clear, none of these variations produces remotely good results.

Why the Naïve Approach Fails

The naïve approach fails because EPS is not a very sophisticated file format.  In particular, it has very poor support for transparency.  Whenever I had a figure that used alpha at all, which is almost every figure, the EPS export turned out badly.  This page on Adobe’s website seems to indicate that Illustrator does some proprietary magic to get decent transparency in EPS files.  Whatever it is, Inkscape doesn’t do it, and I couldn’t find an automatic converter that did.  In addition to Inkscape’s SVG to EPS converter, I tried ImageMagick and Scribus, neither of which did any better, and both of which found new ways to fail.

Rasterization (No! Not Rasterization!)

“No! Not rasterization!” was my first response when I realized that rasterization is by far the easiest way out.  Rasterization is ugly.  It gives you aliased lines and blurry fonts.  And EPS is at least nominally a vector format, so rasterization is particularly painful because it ought not to be necessary. Here’s the obligatory illustration of how ugly rasterized text can be:

Rasterized version of the letter A

Rasterization is ugly!

Also, rasterization gives you huge files!  Here’s how EPS represents vector content:

4 M q 1 0 0 -0.477488 0 275.015381 cm
359.477 352.537 m 322.563 388.606 263.395 387.919 227.324 351.007 c 
191.254 314.087 191.941 254.923 228.855 218.854 c 265.77 182.785 
324.938 183.472 361.008 220.384 c 394.121 254.277 396.633 307.583 
366.848 344.438 c S Q
363.973 108.851 m 365.199 112.59 l 371.363 110.211 l h
363.973 108.851 m f*
0.77053 w
q -0.808223 -0.477488 -1 0.385917 0 275.015381 cm
32.558 -390.287 m 27.223 -387.201 l 27.223 -393.365 l h
32.558 -390.287 m S Q
1.368923 w
1 J
q 1 0 0 -1 0 275.015381 cm
281.66 33.609 m 272.492 27.789 270.355 16.457 276.895 8.297 c 283.43

I don’t know EPS at all; this is just a sample of vector graphics look like in an EPS file.  I’m pretty sure those are drawing commands.  Anyway, compare with raster graphics:


Unlike the vector commands, I can tell you exactly what’s going on there, and it’s not pretty.  Those are 8 bit RGB values in hexadecimal, represented with ASCII text (which means that they take up exactly twice as much space as they need to.)  So one light grey pixel is, for example, ADADAD.  And all those Fs?  Empty white space.  This is why high resolution bitmaps take up a ridiculous amount of space in EPS format.

So much for the case against rasterization.  The case for it is simply that the alternative is much more work..

How to Rasterize an SVG

First, in Inkscape, make a new layer for your background.  Put a big white rectangle in it, and lower this layer to the bottom of the layer stack.  This step prevents the background from being filled in unpredictably.

Inkscape can export directly to raster formats.  As I mentioned, it also exports to EPS, but that naïve route doesn’t work.  Export your figure as a Portable Network Graphics (PNG) file.  Use an embarrassingly large resolution.  This is just an intermediate step, and you can always delete the PNG once you have your EPS.  The PNG is compressed, so it will take up much less space than the EPS anyway. Next comes the part where you need another piece of free software.  Get a copy of ImageMagick.  Then use its convert utility to make an EPS from the PNG.  For example,

convert -resize 50% simplex_schematic.png simplex_schematic.eps

Play around with the percentage by which you resize the figure. Be happy that in this modern era, nobody bats an eye at a four megabyte image file.

A Hybrid Approach

By understanding its limitations, we can make Inkscape’s EPS export work for us.  Remember how I said Inkscape’s rasterization is unpredictable?  We can make it more predictable by rasterizing part of the figure.  If enough of the figure is already rasterized, Inkscape will leave the rest in vector form.  My theory on what gets rasterized is as follows.  Any vector content that has a property that EPS can’t handle, particularly transparency, gets rasterized.  Also, any vector content that interacts with a property EPS can’t handle.  So if you have text under a transparent overly, all of it gets rasterized, even if the text itself is opaque.

The basic hybrid approach is to separate all text in your figure into a separate layer, hide the text layer, and export the rest of the figure as a high-resolution bitmap.  Then import the bitmap, line it up with the vector components it replaces, and hide the vector components of the figure other than text, so you have text overlaid on an opaque raster image.  Finally export as an EPS.  These actions improve the appearance of the figure considerably, since rasterized text looks dreadful.

This approach can be extended to non-text elements of your figure, if you have the patience for it.  This works best for simple elements like arrows and axes, as long as they don’t have anything drawn over them.  The point of diminishing returns arrives rapidly, however.


Inkscape is great. It’s free, and it’s easy to use. If, during the figure creation process, you’re careful about segregating the parts of your figure that force rasterization, you can enjoy the clean lines of vector graphics in your finished figure. Even if you don’t consider the EPS conversion until very late, picking the low-hanging fruit (text) is easy and dramatically improves the appearence of your figure.

Edit (4 February, 2013): A better explanation

See these threads on StackExchange:




9 thoughts on “Converting an SVG to EPS

  1. At least on Linux system you can run pdftops -eps foo.pdf on a pdf you exported from Inkscape. Works fine for me and does not rasterize.

  2. Matt,

    What if we have an SVG with only vector graphics and text? When creating the file directly in Inkscape (i.e., a simple drawing), the direct method seems to work fine. But when starting an eps file in Matlab, then manipulating the text in Inkscape, and trying to save, it deletes my text and some of the lines.

    Some of these rasterization approaches seem overkill for me, since I don’t have any transparency and the figure is relatively simple. Are there any solutions to this issue? Or is it just weird program behavior?

    • I’d have to see your figure to get a handle on exactly what’s going on there. Could you see everything when you opened up the file in Inkscape? If not, it could be that Matlab used a font that Inkscape couldn’t render. Another thing I’ve seen hapen with vector graphics exports is that a lot of programs like to draw empty white boxes around things, and sometimes those boxes wind up being drawn on top when they should be underneath, obscuring parts of the figure.

      If you could see everything in Inkscape but then not subsequently on re-exporting to EPS, then perhaps some odd transparency issue cropped up, or Inkscape had trouble importing the EPS in the first place. To be honest, I’ve never tried importing an EPS, editing, and then exporting EPS using Inkscape. I believe there’s a Matlab package that lets you export SVG instead of EPS, which would probably result in much more predictable behavior on Inkscape’s part.

  3. Hello, Great Post! I was a Corel Draw user, and now already moved to Adobe Illustrator. I am still learning and making Vector art for my WebSite. This guide help me to understand more about Export Files. Thank you very much 🙂

  4. Here’s another solution I found. I am creating figures in Inkscape, and like others I have been unable to get it to export to eps without disappearing objects. I can export to PDF from Inkscape and everything looks fine. There is no rasterization as I have opaque objects. I installed a postcript printer (I’m using Windows 7) – Lexmark C935 PS (MS). I then print from Adobe Acrobat (free viewer version) using the Lexmark PS printer driver, and print to file. If the bounding box isn’t correct I fix that using the ps2eps feature in Ghostview. Convoluted but it does what I need.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s