Skip to content

Instantly share code, notes, and snippets.

@dmy3k
Last active October 11, 2016 12:00
Show Gist options
  • Save dmy3k/ca8e901cbd32d16d44e478c7d8f272aa to your computer and use it in GitHub Desktop.
Save dmy3k/ca8e901cbd32d16d44e478c7d8f272aa to your computer and use it in GitHub Desktop.
#!/bin/sh
#---------------------------------------------------------------
# Creates png files from given svg files in a directory.
# Target png dimensions hardcoded (120px width, height auto).
# Note: you need to `npm install -g svgexport` first.
#
# Usage example:
# ./svgrasterize.sh .
#---------------------------------------------------------------
FILES=$(find $1 -maxdepth 1 -name '*.svg')
for file in $FILES
do
extension="${file##*.}"
filename="${file%.*}"
svgexport "$file" "png/$filename.png" 120:
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment