Skip to content

Instantly share code, notes, and snippets.

@maxme
Created January 10, 2014 07:23
Show Gist options
  • Save maxme/8348158 to your computer and use it in GitHub Desktop.
Save maxme/8348158 to your computer and use it in GitHub Desktop.
#!/bin/sh
# Example inputs:
# dashicon_admin_site 
# dashicon_admin_users 
# dashicon_lock 
# dashicon_edit 
# dashicon_email 
if [ x$2 == x ]; then
echo "Usage: $0 icon_name glyph\nExample: $0 dashicon_email "
exit 1
fi
OUTPUT=$1
CHAR=$2
FONT=dashicons.ttf
COLOR=black
function generate_png() {
convert -size $1 xc:transparent -pointsize $2 -font $3 -gravity center \
-fill $4 -draw "text -0,0 '$5'" $6.png
}
generate_png 96x96 90 $FONT $COLOR $CHAR $OUTPUT@3x
generate_png 64x64 60 $FONT $COLOR $CHAR $OUTPUT@2x
generate_png 48x48 45 $FONT $COLOR $CHAR [email protected]
generate_png 32x32 30 $FONT $COLOR $CHAR $OUTPUT@1x
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment