Created
November 3, 2016 08:46
-
-
Save Bogdaan/a8e1ca52e47cb34e15bf7389bf3e65e5 to your computer and use it in GitHub Desktop.
Create svg vector from png
This file contains hidden or 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 | |
| SRC=/tmp/png-icons | |
| DST=/tmp/svg-icons | |
| for f in `ls $SRC` | |
| do | |
| FILENAME=`basename $f` | |
| FILECLEAR=`basename $f .png` | |
| echo "Processing $f file..." | |
| convert -flatten -threshold 50% ${SRC}/${FILENAME} ${DST}/${FILECLEAR}.bmp | |
| potrace -s -o ${DST}/${FILECLEAR}.svg ${DST}/${FILECLEAR}.bmp | |
| rm ${DST}/${FILECLEAR}.bmp | |
| done | |
| exit 0 | |
| 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 -flatten -threshold 50% $FILE.png $FILE.bmp | |
| potrace -s -o $FILE.svg $FILE.bmp | |
| rm $FILE.bmp | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment