Create a gist now

Instantly share code, notes, and snippets.

@psd /csvg
Created Jun 17, 2010

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