Skip to content

Instantly share code, notes, and snippets.

@connorjan
Created July 14, 2017 21:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save connorjan/813e7605db680159f8273b483bd27bd3 to your computer and use it in GitHub Desktop.
Save connorjan/813e7605db680159f8273b483bd27bd3 to your computer and use it in GitHub Desktop.
Convert an SVG to EPS using Inkscape on macOS
#!/bin/bash
# Requirements:
# You must have the path to Inkscape in your path
# (/Applications/Inkscape.app/Contents/Resources/bin/inkscape)
# You must have coreutils installed ($ brew install coreutils) for greadlink
if (($# < 1)); then
echo "Usage: svg2eps input output"
exit 1
fi
p_in="$1"
input="$(greadlink -f $1)"
if [ -z "$2" ]; then
p_out="${1%.*}.eps"
output="${input%.*}.eps"
else
p_out="$2"
output="$(greadlink -f $2)"
fi
inkscape -z -D -f "$input" -E "$output"
if (($?)); then
echo "Error in conversion"
exit 1
else
echo "Success: $p_in -> $p_out"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment