Created
January 15, 2014 14:47
-
-
Save archgrove/8437529 to your computer and use it in GitHub Desktop.
# resizeIcons.sh
# Creates new sizes from a source PNG in the iOS icon sizes
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 | |
# resizeIcons.sh | |
# Creates new sizes from a source PNG in the iOS icon sizes | |
# [email protected] | |
# Depends: sips (OS X scriptable image processing) | |
function resize { | |
currentImage=$1 | |
newImage=$2 | |
sizeX=$3 | |
sizeY=$4 | |
cp $currentImage $newImage | |
echo "Resizing $currentImage to $newImage at size $sizeX by $sizeY" | |
sips -z $sizeX $sizeY $newImage > /dev/null 2>&1 | |
} | |
if [ -z $1 ]; then | |
echo "Usage: $0 image.png" | |
else | |
source=$1 | |
base=${source%.*} | |
ext="${source##*.}" | |
if [ "png" != $ext ]; then | |
echo "Image must have a PNG extension" | |
else | |
resize $source $base-120.png 120 120 | |
resize $source $base-80.png 80 80 | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment