Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@DenTelezhkin
Created September 30, 2016 07:56
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DenTelezhkin/1a04ab4eceb2b5fac2cf7ae00b0863e8 to your computer and use it in GitHub Desktop.
Save DenTelezhkin/1a04ab4eceb2b5fac2cf7ae00b0863e8 to your computer and use it in GitHub Desktop.
Slice iOS app icons from 1024x1024 PNG file, originally taken from https://gist.github.com/jessedc/837916#file-ios-icon-png-bash-script. Updated for Xcode 8 - September 2016.
#!/bin/bash
f=$(pwd)
sips --resampleWidth 512 "${f}/${1}" --out "${f}/iTunesArtwork"
sips --resampleWidth 1024 "${f}/${1}" --out "${f}/iTunesArtwork@2x"
sips --resampleWidth 20 "${f}/${1}" --out "${f}/Icon-20.png"
sips --resampleWidth 40 "${f}/${1}" --out "${f}/Icon-20@2x.png"
sips --resampleWidth 60 "${f}/${1}" --out "${f}/Icon-20@3x.png"
sips --resampleWidth 29 "${f}/${1}" --out "${f}/Icon-29.png"
sips --resampleWidth 58 "${f}/${1}" --out "${f}/Icon-29@2x.png"
sips --resampleWidth 87 "${f}/${1}" --out "${f}/Icon-29@3x.png"
sips --resampleWidth 40 "${f}/${1}" --out "${f}/Icon-40.png"
sips --resampleWidth 80 "${f}/${1}" --out "${f}/Icon-40@2x.png"
sips --resampleWidth 120 "${f}/${1}" --out "${f}/Icon-40@3x.png"
sips --resampleWidth 120 "${f}/${1}" --out "${f}/Icon-60@2x.png"
sips --resampleWidth 180 "${f}/${1}" --out "${f}/Icon-60@3x.png"
sips --resampleWidth 76 "${f}/${1}" --out "${f}/Icon-76.png"
sips --resampleWidth 152 "${f}/${1}" --out "${f}/Icon-76@2x.png"
sips --resampleWidth 167 "${f}/${1}" --out "${f}/Icon-83.5@2x.png"
@DenTelezhkin
Copy link
Author

Usage:

sh prepare_icons.sh [path_to_your_1024x1024_png_file]

@ravanar-sk
Copy link


saravanas-Mac-mini:abc Saravana$ prepare_icons.sh /Users/folder/Desktop/untitled_folder/icon.png 
-bash: prepare_icons.sh: command not found
saravanas-Mac-mini:abc Saravana$ 

what might be the problem here ?

@DenTelezhkin
Copy link
Author

Check folder from which you are executing command, does it contain prepare_icons.sh script?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment