Last active
February 23, 2021 06:46
-
-
Save sgmonda/d697c1d8f9600d50e035c80c4ebba9c9 to your computer and use it in GitHub Desktop.
Simple script to convert SVG images into PNGs tinted as white
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 | |
# Converts provided SVGs into PNGs tinted as white | |
# Usage: | |
# $ ./iconmaker.sh in/directory/ out/directory/ | |
IN_DIR=$1 | |
OUT_DIR=$2 | |
TMP_DIR=/tmp | |
mkdir -p $OUT_DIR | |
for fname in $(ls $IN_DIR) | |
do | |
inpath=$IN_DIR"/"$fname | |
tmppath=$(echo $TMP_DIR"/"$fname | sed 's/svg$/png/g') | |
outpath=$(echo $OUT_DIR"/"$fname | sed 's/svg$/png/g') | |
mogrify -background none -resize 512x512 -format png -path $TMP_DIR $inpath && | |
convert -channel RGB -negate $tmppath $outpath | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment