Skip to content

Instantly share code, notes, and snippets.

@yuanotes
Last active April 8, 2024 18:57
Show Gist options
  • Save yuanotes/49d093a5c6c0ff1c1e08 to your computer and use it in GitHub Desktop.
Save yuanotes/49d093a5c6c0ff1c1e08 to your computer and use it in GitHub Desktop.
Convert png to svg.
#!/bin/bash
if [ "$1" == "" ]; then
echo Usage: $0 pngfile
exit 0
fi
FILE=`basename $1 .png`
if [ ! -e $FILE.png ]; then
echo $FILE.png does not exist
exit 1
fi
convert $FILE.png -background white -alpha remove $FILE.pnm
potrace -s -o $FILE.svg $FILE.pnm
rm $FILE.pnm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment