Skip to content

Instantly share code, notes, and snippets.

@cwoodall cwoodall/png2svg.sh
Created Dec 29, 2016

Embed
What would you like to do?
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
You can’t perform that action at this time.