You are here: start » Snippets » svg2eps

svg2eps

The script

You need to have Inkscape installed and in your path for this to work.

#!/bin/bash
 
INPUT=$1
 
if [ -n "$2" ]
then
    OUTPUT=$2
else
    OUTPUT=${INPUT%.*}.eps
fi
 
echo Converting $INPUT to $OUTPUT...
 
inkscape --export-text-to-path --export-bbox-page --without-gui --file=$INPUT --export-eps=$OUTPUT &> /dev/null

I decided to redirect stdout and stderr to /dev/null as Inkscape is quite verbose when it doesn't like something about the svg you are making it convert. Feel free to comment that &> /dev/null out if you want to be hit with the full verbosity though ;)

Hint: If you want to preprocess the svg's contents prior to conversion (e.g. for removing certain parts using grep -v), pipe the output of the preprocession step to the inkscape-call and make it use /dev/fd/0 (stdin) as input file instead of $INPUT.

Usage

  • svg2eps infile.svg outfile.eps – Converts infile.svg to outfile.eps
  • svg2eps file.svg – Converts file.svg to file.eps

Acknowledgements

The Inkscape-Fu was based on this entry in the lyx wiki.

Discussion

Enter your comment (wiki syntax is allowed):
XFAMY
snippets/svg2eps.txt · Last modified: 2008/03/26 12:35 (external edit)