Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Convert png to svg using imagemagick and potrace
if [ "$1" == "" ]; then
echo Usage: $0 pngfile
exit 0;
FILE=`basename $1 .png`
if [ ! -e $FILE.png ]; then
echo $FILE.png does not exist
exit 1;
convert $FILE.png $FILE.pnm
potrace -s -o $FILE.svg $FILE.pnm
rm $FILE.pnm

Can you please reply me with the code (.bat file) for Windows version??


ghost commented Apr 30, 2015

Wow thanks for this! Really useful <3

Nice script! I love it ;)

with alpha channel to white

convert $FILE.png -fx 'a==0 ? white : u' $FILE.pnm

rjpeart commented Mar 8, 2017

Keeping alpha channel as white with the above didn't work for me. Instead I used

convert $FILE.png -background White -alpha Background $FILE.pnm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment