Created
June 7, 2012 22:17
-
-
Save ykarikos/2892009 to your computer and use it in GitHub Desktop.
Convert png to svg using imagemagick and potrace
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
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!
Cant convert coloured PNG to SVG, produced svgs are BW
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is a shell script for Unix/Linux/Posix systems. "make it executable" means doing the following:
If you are on a Windows system, it doesn't mean anything as Windows filesystem doesn't support setting executable bit.
Windows doesn't have a Posix shell. So you won't be able to use this script unless you have an environment like MSYS2 or Cygwin installed.