Skip to content

Instantly share code, notes, and snippets.

@DenTelezhkin
Created September 30, 2016 07:56
Show Gist options
  • 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}/[email protected]"
sips --resampleWidth 60 "${f}/${1}" --out "${f}/[email protected]"
sips --resampleWidth 29 "${f}/${1}" --out "${f}/Icon-29.png"
sips --resampleWidth 58 "${f}/${1}" --out "${f}/[email protected]"
sips --resampleWidth 87 "${f}/${1}" --out "${f}/[email protected]"
sips --resampleWidth 40 "${f}/${1}" --out "${f}/Icon-40.png"
sips --resampleWidth 80 "${f}/${1}" --out "${f}/[email protected]"
sips --resampleWidth 120 "${f}/${1}" --out "${f}/[email protected]"
sips --resampleWidth 120 "${f}/${1}" --out "${f}/[email protected]"
sips --resampleWidth 180 "${f}/${1}" --out "${f}/[email protected]"
sips --resampleWidth 76 "${f}/${1}" --out "${f}/Icon-76.png"
sips --resampleWidth 152 "${f}/${1}" --out "${f}/[email protected]"
sips --resampleWidth 167 "${f}/${1}" --out "${f}/[email protected]"
@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