Last active
March 7, 2016 05:41
-
-
Save carlosmcevilly/a16b8a29a203055c8972 to your computer and use it in GitHub Desktop.
Generate sized icons for iOS and Watch development using ImageMagick convert
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 | |
# IMPORTANT: the default options for convert might not give you the | |
# same quality you will get from Gimp or Photoshop. You might have | |
# to dig into the convert command line options and tweak them to | |
# suit what kind of conversion you want. Someday I will do that... | |
# for now this script is best used for making test icon suites. | |
# requires ImageMagick for the 'convert' command below. | |
# http://www.imagemagick.org or on OS X: brew install imagemagick | |
# Edit the specs list below as needed. Format is points:scale | |
# This is incomplete... just threw this together and it's missing, for example, iPad sizes. | |
# Plus see the special case size at the end of the script. | |
# To add more sizes, just add the points:scale numbers for the size to the specs list here. | |
export specs="24:2 29:2 29:3 40:2 40:3 44:2 60:2 60:3 86:2 98:2" | |
export infile=$1 | |
if [[ "$infile" == '' ]]; then | |
echo usage: $0 \<input image filename\> | |
exit -1 | |
fi | |
for spec in $specs; do | |
echo doing spec $spec | |
export points=`echo $spec | cut -f 1 -d':'`; | |
export scale=`echo $spec | cut -f 2 -d':'`; | |
let "size = $points * $scale" | |
convert $infile -geometry ${size}x$size icon-$points\@${scale}x.png | |
done | |
# special case | |
convert $infile -geometry 55x55 icon-27.5\@2x.png |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment