Created
August 24, 2018 16:50
-
-
Save jasonmerino/515c535766f566cab833ef8a367ecaf2 to your computer and use it in GitHub Desktop.
An icon resizing script for iOS projects.
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/bash | |
# About | |
# This script will resize your original app icon into all needed | |
# icon sizes. Images will be created in the same folder as this | |
# script. From there you just need to drag them to the appropriate | |
# image locations in Xcode. | |
# | |
# Usage | |
# 1. Move this script and your source image into the same directory. | |
# 2. Make sure this script is executable with `chmod +x icon-resizer.sh`. | |
# 3. Call script with `./icon-resizer.sh originalAppIcon.png` | |
f=$(pwd) | |
# 20 | |
sips --resampleWidth 20 "${f}/${1}" --out "${f}/AppIcon20.png" | |
sips --resampleWidth 40 "${f}/${1}" --out "${f}/AppIcon20@2x.png" | |
sips --resampleWidth 60 "${f}/${1}" --out "${f}/AppIcon20@3x.png" | |
# 29 | |
sips --resampleWidth 29 "${f}/${1}" --out "${f}/AppIcon29.png" | |
sips --resampleWidth 58 "${f}/${1}" --out "${f}/AppIcon29@2x.png" | |
sips --resampleWidth 87 "${f}/${1}" --out "${f}/AppIcon29@3x.png" | |
# 40 | |
sips --resampleWidth 40 "${f}/${1}" --out "${f}/AppIcon40.png" | |
sips --resampleWidth 80 "${f}/${1}" --out "${f}/AppIcon40@2x.png" | |
sips --resampleWidth 120 "${f}/${1}" --out "${f}/AppIcon40@3x.png" | |
# 60 | |
sips --resampleWidth 120 "${f}/${1}" --out "${f}/AppIcon60@2x.png" | |
sips --resampleWidth 180 "${f}/${1}" --out "${f}/AppIcon60@3x.png" | |
# 76 | |
sips --resampleWidth 76 "${f}/${1}" --out "${f}/AppIcon76.png" | |
sips --resampleWidth 152 "${f}/${1}" --out "${f}/AppIcon76@2x.png" | |
# 83.5 | |
sips --resampleWidth 167 "${f}/${1}" --out "${f}/AppIcon83_5@2x.png" | |
# 1024 | |
sips --resampleWidth 1024 "${f}/${1}" --out "${f}/AppIcon1024.png" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment