Skip to content

Instantly share code, notes, and snippets.

@agryson
Last active January 17, 2017 21:20
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 agryson/6d63fad5125cfd30602bc420bc73fe3d to your computer and use it in GitHub Desktop.
Save agryson/6d63fad5125cfd30602bc420bc73fe3d to your computer and use it in GitHub Desktop.
Exports all svgs in the current folder to png's of the specified size (64px by default)
#!/bin/bash
input=${1:-64}
#Creates output directory if it doesn't exist and empties it.
mkdir ~/Pictures/exportOutput
rm ~/Pictures/exportOutput/*.png
for file in *.svg
do
filename=$(basename "$file")
filename="${filename%.*}"
#This adds the size to the output, remove "_${input}" from the following filename if that's not desired
/usr/bin/inkscape -z "${file}" -w $input -h $input -e "~/Pictures/exportOutput/${filename}_${input}.png"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment