Skip to content

Instantly share code, notes, and snippets.

@Bogdaan
Created November 3, 2016 08:46
Show Gist options
  • Select an option

  • Save Bogdaan/a8e1ca52e47cb34e15bf7389bf3e65e5 to your computer and use it in GitHub Desktop.

Select an option

Save Bogdaan/a8e1ca52e47cb34e15bf7389bf3e65e5 to your computer and use it in GitHub Desktop.
Create svg vector from png
#!/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