Skip to content

Instantly share code, notes, and snippets.

@psd
Created June 17, 2010 19:49
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save psd/442683 to your computer and use it in GitHub Desktop.
Save psd/442683 to your computer and use it in GitHub Desktop.
csvg — create SVG from a bitmap image
#!/bin/sh
#
# convert bitmap to SVG, works well with pen and ink drawings ..
#
set -e
for file in "$@"
do
# lose suffix to grab file basename
suffix=$(echo "$file" | sed 's/.*\.//')
svg=$(basename "$file" ".$suffix").svg
pnm=/tmp/$$.pnm
# convert to pixmap using http://www.imagemagick.org
convert "$file" $pnm
# trace bitmap using http://potrace.sourceforge.net
potrace -s -o "$svg" $pnm
rm $pnm
done
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment