76

What is the best way to convert from an EPS formatted vector graphic to an SVG formatted graphic using only freely available tools?

Franck Dernoncourt
  • 20,384
  • 48
  • 186
  • 322
user13137
  • 1,010
  • 2
  • 10
  • 19

15 Answers15

40

Currently what's working best for me on linux is the following:

epstopdf foo.eps
pdf2svg foo.pdf foo.svg

I believe the first command is a wrapper for ghostscript, and the second is a wrapper for calls to the Poppler and Cairo libraries. On ubuntu, they're in the packages texlive-font-utils and pdf2svg. Gradients come out looking right, but don't seem to be editable in inkscape.

I tried using inkscape and uniconverter for this purpose, and as of Jan 2013, both seemed broken when tested on an example containing nothig but some very simple line art. Inkscape throws errors and can't open the eps file. Uniconverter crashes.

Scribus and sk1 may work, but seem awkward and not really suited for this task.

  • 2
    This worked perfectly for me and produced a nice small svg file. In my case, I wanted to output the svg inline on a webpage, so size and compatibility matters. – RevNoah Jun 23 '16 at 17:36
  • This works on mac with: `brew install ghostscript pdf2svg`, then follow the above steps but use `ps2pdf` instead of `epstopdf`. – Hassan Jul 29 '21 at 20:08
32

Uniconvertor is currently the most convenient option.

It's a command-line tool that shares code with the sK1 Project. You won't have to bother cropping the image in sK1 if you use uniconvertor, so it's more automated.

Run it like this:

uniconvertor before.eps after.svg

And that's it. I tried it on one EPS, but the SVG was offset improperly, but it may work for you.

Here's a list of alternatives and reasons why they suck:

  1. The sK1 Project

    It has the sense of a "page" that you put your drawing on, so after you import an EPS, you have to move it around and manually crop the page.

  2. ImageMagick

    For EPS to SVG conversion, ImageMagick does some really stupid bitmap conversion and will render SVG files that are 50mb, when they should be a few kb. It doesn't actually have a real vector conversion algorithm for these formats.

  3. InkScape

    Every time I've converted an EPS with InkScape, it's messed up the colours. This is due to an Inkscape bug with importing EPS files. (Update: Fix Released for this bug on February 2015)

  4. Gimp

    Gimp just does the same stupid bitmap conversion that ImageMagick does.

  5. Scribus

    It gets the colours of my EPS file even more wrong than Inkscape, while Preview for Mac can read it just fine.

Neil
  • 5,520
  • 9
  • 41
  • 54
  • 1
    Did you install it on OS X, and if so, how? Could help this guy out here? [How to install Uniconverter (command-line app) on Mac OS 10.7.2 (Lion)?](http://superuser.com/questions/374818/how-to-install-uniconverter-command-line-app-on-mac-os-10-7-2-lion) – slhck Jan 05 '12 at 08:08
  • I didn't install it in OS X. I was testing all of that software in Linux, but merely noticed that Preview on Mac OS X just works. – Neil Jan 11 '12 at 00:00
  • 1
    uniconverter does not preserves linear or radial gradients - after converting it's all solid coloured – drahnr Aug 03 '12 at 07:37
  • Uniconvertor doesn't support C5D0D3C6-type EPS files (the most common type). Scribus doesn't import half the file on the ones I've tried. Inkscape for Windows doesn't support EPS at all. Just install pstoedit on Linux, and use that (again, the Windows version is broken). – Mark Jun 30 '13 at 00:23
  • 3
    Hello from the future, just wanted to say thanks for pointing to the bug report for inkscape. Some kind soul went in and fixed the bug and just upgrading to the latest release allowed me to drag and drop an EPS and get the proper result in Inkscape. – shaunhusain Mar 13 '15 at 03:01
  • At least as of version 1.1.5 it does not support EPS version 3.1. – jcoffland Apr 12 '15 at 00:42
  • Has Image Magick improved on this conversion? It just tried and works fine. Just run `convert this.eps to_this.svg` – toto_tico Oct 23 '15 at 18:42
  • Uniconvertor 2.0 doesn't seem to support output to SVG – That Brazilian Guy Dec 07 '15 at 15:24
  • Today, August 2020, `uniconvertor --help` does not list EPS as input format (and running it gets me "Error while loading ... The file may be corrupted or contains unknown file format."). – Arjan Aug 14 '20 at 10:27
  • 3
    I just tried it, with `uniconvertor input.eps output.svg` it didn't convert the vector graphics just rasterized an image and base64 encoded it and put in the SVG! – Wis Aug 24 '20 at 19:27
21

You should be able to open the EPS in inkscape and save as SVG from there.

Make sure to save as Plain SVG not inkscape SVG for better comparability. Adobe illustrator can do the same thing, its not free, but the trial version is.

alpha1
  • 1,686
  • 1
  • 14
  • 18
  • 1
    I have tried several times to convert an EPS to SVG with Inkskape, and every time it gets the colours and layers all wrong. It's not at all reliable. – Neil Jun 11 '11 at 14:42
  • 1
    @Brilliand but other way around, inskape still corrupts data and breaks EPS files when exporting to EPS. Currently, I use online website to convert svg to eps which isn't very practical. – Tomáš Zato Mar 28 '15 at 14:37
  • 1
    Admittedly using a very simple EPS, I just had perfect results using Inkscape. – GKFX May 12 '15 at 17:09
  • 7
    This can also be done [using the command line](http://tavmjong.free.fr/INKSCAPE/MANUAL/html/CommandLine.html): `inkscape --export-plain-svg output.svg input.eps` – jja Sep 30 '15 at 16:55
  • @jja you comment should have been an answer! – sanmai Dec 19 '17 at 08:11
  • 5
    I was unable to open or import 7 different EPS files in Inkscape 0.92. – Thomas Weller Jan 30 '18 at 13:19
17

I had much better results with:

ps2pdf -dEPSCrop infile.eps
pdf2svg infile.pdf outfile.svg

The resulting SVG was much cleaner.

Walf
  • 430
  • 6
  • 12
Erik
  • 385
  • 5
  • 14
  • 1
    Agree, and beauty of the ps2pdf command is that it is installed with ghostscript. The -dEPSCrop EPS parameter was a good tip! Hidden in the doc -> use.htm file. – V Stuart Foote Aug 31 '14 at 18:22
  • 2
    But this way, vector images in eps files created with Illustrator get converted to raster :-( – gerlos Sep 04 '14 at 11:16
  • Would you be able to link to such a file? I don't have Illustrator. – Erik Sep 05 '14 at 10:02
  • Just as gerlos said, unfortunately this doesn't maintain the vector graphics but converts to rasterized image instead. – Czechnology Mar 29 '17 at 17:01
  • 3
    Shouldn't it be `pdf2svg infile.pdf outfile.svg` instead of `infile.eps`? (and @gerlos my eps converted to a real svg here, no rasterization... but I don't know which program was used to create the eps file) – mozzbozz Oct 24 '18 at 09:02
  • pdf2svg did not work for me - it was unable to open the .eps files. – Preza8 Oct 21 '20 at 22:31
  • @jost21 Nope, it do not seem to be a typo... with `-dEPSCrop` it should create an EPS file without the middle _step_ through a PDF... – Hastur Feb 01 '21 at 13:49
  • This should be the accepted answer, one minor correction first command will create a pdf file, and second command should use infile.pdf instead of infile.eps – Lyoneel Mar 26 '23 at 00:43
8
  1. Install Inkscape (I was on Ubuntu)

sudo apt-get install inkscape

  1. EPS to SVG

inkscape input.eps -l converted.svg

  1. SVG to PNG

inkscape input.svg -e converted.png

Peregrino69
  • 4,526
  • 2
  • 22
  • 30
timelf123
  • 189
  • 1
  • 2
7

Actually, opening in Inkscape is only possible if you have Ghostscript installed and some conversion script is in your $PATH$ - I could not get this to work on Windows 7. On Linux, it's easier.

studiohack
  • 13,468
  • 19
  • 88
  • 118
MichielB
  • 283
  • 4
  • 11
6

Ben's solution (with a slight modification: eps2pdf => epspdf):

epspdf infile.eps
pdf2svg infile.pdf outfile.svg

worked flawlessly for me. I am using Ubuntu 11.04. The conversion was fast and it preserved colours perfectly. Thanks to the developers and to Ben for recommending this solution.(I also tried all the other solutions mentioned, but they all failed me because of missing installation dependencies or loss of palette information.)

user256274
  • 61
  • 1
  • 2
4

You might also want to try Scribus (it does import EPS, it has a solid CMYK support, and I don't know till what extent, but saves as svg) , or, SK1 project. But this last one yet only works in linux. (soon to appear OSX and Windows ports) The difference with Inkscape (for just the conversion) seems to be a better CMYK and other printing features support.

S.gfx
  • 1,708
  • 11
  • 14
  • 1
    I've used Scripus for that. It's sad there's no CLI interface. – Adobe Sep 05 '12 at 07:44
  • `brew install --cask Scribus` and all went well. You can drag and drop the EPS into the window, then simply File > Export and things will work out. Inkscape is too bloated for a simple conversion. I'm not a designer, I just wanted to convert my EPS to a SVG to get it into Krita and thus rasterize it. – Martin Braun Nov 11 '22 at 11:22
2

use dvisvgm (which is usually included in LaTeX toolchains)

dvisvgm -E example.eps
A Code Cow
  • 21
  • 1
1

pstoedit

pstoedit is a tool converting PostScript and PDF files into various other formats suported by different drawing editors.

pstoedit -f plot-svg before.eps after.svg

On OS  X, you can install it using port: sudo port install pstoedit

Michael Schmid
  • 311
  • 2
  • 7
  • This would be the best way if it wouldn't be broken. The latest version of pstoedit still uses ghostscript option `-dDELAYBIND` for `plot-svg` which has been removed from the latest version of ghostscript. Still upvoted, – Christian Hujer Aug 09 '18 at 06:12
1

https://cloudconvert.com/eps-to-svg is the absolute easiest solution i've found since inkscape, gravitdesigner, and virtually all other software seem to inexplicably have issues with this - cloudconvert seems to work flawlessly.

  • 1
    Excessive promotion of a specific product/resource may be perceived by the community as **spam**. Take a look at the [help], specially [What kind of behavior is expected of users?](//superuser.com/help/behavior)'s last section: _Avoid overt self-promotion_. You might also be interested in [How to not be a spammer](//superuser.com/help/promotion) and [How do I advertise on Super User?](http://superuser.com/help/advertising). – double-beep Mar 31 '19 at 17:19
  • 1
    Just like InkScape this online service screws up the font in the eps. Renders a substitute font which is nowhere near the original. Although all it has to do is to trace the font which is vectorial in itself. – Csaba Toth Dec 18 '22 at 02:07
1

I struggle with this, after downloading a vector image from a stock photo website, I ended up with a 9MB EPS file for which I do not have Adobe Illustrator to edit it.

LibreOffice offered to open it but failed, Inkspace and Scribus both also failed to open it. Only Ghostscript was able to preview it.

Finding this Q&A moved me forward.

I ended up doing these steps:

  1. eps2eps (for some reason this results in a "cleaner" EPS file)
  2. epstopdf
  3. pdf2svg works but produces an SVG file that takes minutes to load in Inkscape, and then forever to Ungroup because it has 300,000 objects from the root
  4. pdftocairo is my life-saver, it conveniently allowed me to crop the resulting PDF file to only the part that I am interested in resulting in SVG files that only has 10,000 objects which Inkspace can ungroup readily and I was able to edit it with ease. The command line looks like this:

    pdftocairo -svg -x 0 -y 0 -W 65 -H 70 o.pdf oo.svg

NOTE: The -x -y -W -H specify which region to crop from the big file (the unit is point for vector images).

Will
  • 111
  • 2
0

For Mac OS X:

Prerequisetes: homebrew, xcode [tools]

  1. Install MacTeX first tug.org/mactex/mactex-download.html (2.5Gb download)
  2. Then you need to download texlua and install at your PATH minimals.contextgarden.net/current/bin/luatex/osx-intel/bin/
  3. Then download, unarchive and install at your PATH the epspdf.tlu tool tex.aanhet.net/epspdf/#releases
  4. Then brew install poppler pdf2svg

After all you can use the following sequence:

epspdf.tlu somegfx.eps somegfx.pdf
pdf2svg somegfx.pdf somegfx.svg

Works fine for me on Mavericks

fobdy
  • 1
0

I might be missing something, but I had not troubles with Image Magick:

convert this.eps to_this.svg

toto_tico
  • 591
  • 4
  • 9
-1

require inkscape.

for i in *
do
    inkscape "$i" --export-plain-svg="$(echo "$i" | sed -e s/eps$/svg/)"
done
ilnanny
  • 1
  • 1