Converting from EPS to SVG format [closed]
What is the best way to convert from an EPS formatted vector graphic to an SVG formatted graphic using only freely available tools?
15 Answers
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.
6Currently what's working best for me on linux is the following:
epstopdf foo.eps
pdf2svg foo.pdf foo.svgI 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.
2Uniconvertor 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.svgAnd 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:
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.
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.
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)
Gimp
Gimp just does the same stupid bitmap conversion that ImageMagick does.
Scribus
It gets the colours of my EPS file even more wrong than Inkscape, while Preview for Mac can read it just fine.
I had much better results with:
ps2pdf -dEPSCrop infile.eps
pdf2svg infile.eps outfile.svgThe resulting SVG was much cleaner.
7Install Inkscape on Ubuntu
sudo apt-get install inkscape
EPS to SVG CLI
inkscape filename.eps -l filename.svg
SVG to PNG CLI
inkscape filename.svg -e filename.png
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.
Ben's solution (with a slight modification: eps2pdf => epspdf):
epspdf infile.eps
pdf2svg infile.pdf outfile.svgworked 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.)
0You 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.
1I 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:
- eps2eps (for some reason this results in a "cleaner" EPS file)
- epstopdf
- 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
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).
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.svgOn OS X, you can install it using port: sudo port install pstoedit
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.
1use dvisvgm (which is usually included in LaTeX toolchains)
dvisvgm -E example.eps I might be missing something, but I had not troubles with Image Magick:
convert this.eps to_this.svg
For Mac OS X:
Prerequisetes: homebrew, xcode [tools]
- Install
MacTeXfirst (2.5Gb download) - Then you need to download
texluaand install at yourPATH - Then download, unarchive and install at your
PATHtheepspdf.tlutool - Then
brew install poppler pdf2svg
After all you can use the following sequence:
epspdf.tlu somegfx.eps somegfx.pdf
pdf2svg somegfx.pdf somegfx.svgWorks fine for me on Mavericks
require inkscape.
for i in *
do inkscape "$i" --export-plain-svg="$(echo "$i" | sed -e s/eps$/svg/)"
done