Last active
June 26, 2019 07:38
-
-
Save Klemek/f23b38356b798b4527a27bd6de4771bb to your computer and use it in GitHub Desktop.
Download then convert latest Font Awesome SVGs into PNGs
This file contains hidden or 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 | |
#Automatically download then convert Font Awesome SVGs to PNGs | |
#need git, node installed, imagemagick and svgexport (npm install svgexport -g) | |
#First, in the folder, do : | |
#git clone https://github.com/FortAwesome/Font-Awesome --depth=1 | |
task(){ | |
svgexport Font-Awesome/svgs/$1/$2.svg pngs/$1/black/$2.png > /dev/null | |
convert pngs/$1/black/$2.png -channel RGB -threshold -1 pngs/$1/white/$2.png > /dev/null | |
echo $1/$2 | |
} | |
rm -rf pngs | |
rm -rf svgs | |
mkdir pngs | |
N=4 | |
( | |
for f1 in Font-Awesome/svgs/*; do | |
folder=${f1##*/} | |
mkdir pngs/$folder | |
mkdir pngs/$folder/black | |
mkdir pngs/$folder/white | |
for f2 in $f1/*.svg; do | |
((i=i%N)); ((i++==0)) && wait | |
name=${f2##*/} | |
base=${name%.svg} | |
if [ -f pngs/$folder/white/$base.png ]; then | |
echo exists $folder/$base | |
else | |
task $folder $base & | |
fi | |
done | |
done | |
) | |
cp -r Font-Awesome/svgs ./ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment