Skip to content

Instantly share code, notes, and snippets.

@cwoodall
Created December 29, 2016 19:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cwoodall/896ba3d6a6fcfb85f4e858d718aa42e4 to your computer and use it in GitHub Desktop.
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
#!/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