-
-
Save willbrandin/59b32d862e6d38e63047f36874f9a8f3 to your computer and use it in GitHub Desktop.
App Icon generator script, based on: https://gist.github.com/donnywals/3be3774435cf53133ee7f8c553e9c080
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 | |
# Takes filename as parameter. | |
file=$1 | |
if [ -z "$file" ] | |
then | |
echo "<png_file> argument not specified." | |
exit 1 | |
elif [ ! -f "$file" ] | |
then | |
echo "$file was not found." | |
exit 1 | |
fi | |
iconSet="AppIcon.appiconset" | |
rm -rf $iconSet | |
mkdir -p $iconSet | |
# Icon 20 | |
convert $file -resize 20x20 $iconSet/icon-20@1x.png | |
convert $file -resize 40x40 $iconSet/icon-20@2x.png | |
convert $file -resize 60x60 $iconSet/icon-20@3x.png | |
# Icon 29 | |
convert $file -resize 29x29 $iconSet/icon-29@1x.png | |
convert $file -resize 58x58 $iconSet/icon-29@2x.png | |
convert $file -resize 87x87 $iconSet/icon-29@3x.png | |
# Icon 40 | |
convert $file -resize 40x40 $iconSet/icon-40@1x.png | |
convert $file -resize 80x80 $iconSet/icon-40@2x.png | |
convert $file -resize 120x120 $iconSet/icon-40@3x.png | |
# Icon 50 | |
convert $file -resize 50x50 $iconSet/icon-50@1x.png | |
convert $file -resize 100x100 $iconSet/icon-50@2x.png | |
# Icon 57 | |
convert $file -resize 57x57 $iconSet/icon-57@1x.png | |
convert $file -resize 114x114 $iconSet/icon-57@2x.png | |
# Icon 60 | |
convert $file -resize 120x120 $iconSet/icon-60@2x.png | |
convert $file -resize 180x180 $iconSet/icon-60@3x.png | |
# Icon 72 | |
convert $file -resize 72x72 $iconSet/icon-72@1x.png | |
convert $file -resize 144x144 $iconSet/icon-72@2x.png | |
# Icon 76 | |
convert $file -resize 76x76 $iconSet/icon-76@1x.png | |
convert $file -resize 152x152 $iconSet/icon-76@2x.png | |
# Icon 83.5 | |
convert $file -resize 167x167 $iconSet/icon-83_5@2x.png | |
# Icon marketing | |
cp $file $iconSet/ios-marketing.png | |
json='{ "info" : { "version" : 1, "author" : "xcode" }, "images" : [ { "size" : "40x40", "idiom" : "ipad", "filename" : "icon-40@1x.png", "scale" : "1x" }, { "size" : "40x40", "idiom" : "ipad", "filename" : "icon-40@2x.png", "scale" : "2x" }, { "size" : "60x60", "idiom" : "iphone", "filename" : "icon-60@2x.png", "scale" : "2x" }, { "size" : "72x72", "idiom" : "ipad", "filename" : "icon-72@1x.png", "scale" : "1x" }, { "size" : "72x72", "idiom" : "ipad", "filename" : "icon-72@2x.png", "scale" : "2x" }, { "size" : "76x76", "idiom" : "ipad", "filename" : "icon-76@1x.png", "scale" : "1x" }, { "size" : "76x76", "idiom" : "ipad", "filename" : "icon-76@2x.png", "scale" : "2x" }, { "size" : "50x50", "idiom" : "ipad", "filename" : "icon-50@1x.png", "scale" : "1x" }, { "size" : "50x50", "idiom" : "ipad", "filename" : "icon-50@2x.png", "scale" : "2x" }, { "size" : "29x29", "idiom" : "iphone", "filename" : "icon-29@1x.png", "scale" : "1x" }, { "size" : "29x29", "idiom" : "iphone", "filename" : "icon-29@2x.png", "scale" : "2x" }, { "size" : "57x57", "idiom" : "iphone", "filename" : "icon-57@1x.png", "scale" : "1x" }, { "size" : "57x57", "idiom" : "iphone", "filename" : "icon-57@2x.png", "scale" : "2x" }, { "size" : "29x29", "idiom" : "iphone", "filename" : "icon-29@3x.png", "scale" : "3x" }, { "size" : "40x40", "idiom" : "iphone", "filename" : "icon-40@3x.png", "scale" : "3x" }, { "size" : "60x60", "idiom" : "iphone", "filename" : "icon-60@3x.png", "scale" : "3x" }, { "size" : "40x40", "idiom" : "iphone", "filename" : "icon-40@2x.png", "scale" : "2x" }, { "size" : "29x29", "idiom" : "ipad", "filename" : "icon-29@1x.png", "scale" : "1x" }, { "size" : "29x29", "idiom" : "ipad", "filename" : "icon-29@2x.png", "scale" : "2x" }, { "size" : "83.5x83.5", "idiom" : "ipad", "filename" : "icon-83_5@2x.png", "scale" : "2x" }, { "size" : "20x20", "idiom" : "iphone", "filename" : "icon-20@2x.png", "scale" : "2x" }, { "size" : "20x20", "idiom" : "iphone", "filename" : "icon-20@3x.png", "scale" : "3x" }, { "size" : "20x20", "idiom" : "ipad", "filename" : "icon-20@1x.png", "scale" : "1x" }, { "size" : "20x20", "idiom" : "ipad", "filename" : "icon-20@2x.png", "scale" : "2x" }, { "size" : "1024x1024", "idiom" : "ios-marketing", "filename" : "ios-marketing.png", "scale" : "1x" } ] }' | |
echo $json > $iconSet/Contents.json |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment