Created
December 29, 2016 19:48
-
-
Save cwoodall/896ba3d6a6fcfb85f4e858d718aa42e4 to your computer and use it in GitHub Desktop.
A script for making png's from svg's. From http://stackoverflow.com/questions/1861382/convert-png-to-svg
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 | |
# credit to olibre from stackoverflow (http://stackoverflow.com/questions/1861382/convert-png-to-svg) | |
File_png="${1?:Usage: $0 file.png}" | |
if [[ ! -s "$File_png" ]]; then | |
echo >&2 "The first argument ($File_png)" | |
echo >&2 "must be a file having a size greater than zero" | |
( set -x ; ls -s "$File_png" ) | |
exit 1 | |
fi | |
File="${File_png%.*}" | |
convert "$File_png" "$File.pnm" # PNG to PNM | |
potrace "$File.pnm" -s -o "$File.svg" # PNM to SVG | |
rm "$File.pnm" # Remove PNM |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment