Skip to content

Instantly share code, notes, and snippets.

@ykarikos
Created June 7, 2012 22:17
  • Star 60 You must be signed in to star a gist
  • Fork 14 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
Convert png to svg using imagemagick and potrace
#!/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 $FILE.pnm
potrace -s -o $FILE.svg $FILE.pnm
rm $FILE.pnm
@MiaLinlinLu
Copy link

convert infile.png pnm:- | potrace -s -o outfile.svg

Hi, I have a question. When I convert it, it converted a RGB image to a BlackWhite SVG. How could I correct this?
thank you!

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