Created
October 12, 2012 23:51
-
-
Save johno/3882371 to your computer and use it in GitHub Desktop.
Glyphicons Cleanup
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/sh | |
# Arg 1 <path_to_dir/glyphicon_dir> | |
# Arg 2 <path_to_dir/new_glyphicon_dir> | |
# | |
# Requires ImageMagick | |
# | |
# This script takes the original glyphicon directory as arg1, | |
# Cleans up the names for a sprite sheet and places them into | |
# The specified directory from arg2. Then, it makes white and | |
# blue copies of the glyphicons in the new directory, as well. | |
# | |
# This could be done more efficiently, but oh well. | |
newdir=~/Desktop/$2 | |
mkdir $newdir | |
for file in `ls $1 | grep @` ; do | |
cp $1/$file $newdir | |
done | |
for file in $newdir/* ; do | |
mv $file `echo $file | sed 's/glyphicons_[0-9][0-9][0-9]_//'` | |
done | |
for file in $newdir/* ; do | |
mv $file `echo $file | sed 's/@2x.png/.png/'` | |
done | |
for file in $newdir/* ; do | |
convert $file -quantize GRAY -negate `echo $file | sed 's/.png/-white.png/'` | |
convert `echo $file | sed 's/.png/-white.png/'` -fuzz 70% -fill '#0398d6' -opaque white `echo $file | sed 's/.png/-blue.png/'` | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment