Commit b23a9a95 authored by Egor Badaev's avatar Egor Badaev
Browse files

customizable destination and source

parent f4799a0b
*.docx
*.zip
*.png
iconset/
.DS_Store
How to generate iconset
=======================
1. Put your icon in a folder (preferably, empty) and rename it to **sourceIcon.png**.
2. Copy **generate_iconset.sh** to this folder.
5. Open *Terminal*, navigate to this folder.
6. Set the execute permissions to this script:
1. Simply execute script:
chmod +x generate_iconset.sh
./generate_iconset.sh /path/to/project/folder.xcassets/AppIcon.iconset /path/to/sourceIcon.png
7. Execute script:
The script requires two parameters:
./generate_iconset.sh ~/Desktop/path/to/project
* path to AppIcon.iconset folder (including the folder itself) - if omitted, the icons are left in the iconset folder
* path to sourceIcon.png (optional; if omitted, the script takes sourceIcon.png from the script folder)
8. Done! Icons are copied to your project’s **images.xcassets** folder.
9. If upgrading from previous versions of icon generators, in *xCode*, navigate to **images.xcassets** folder in Project Navigator and move icon files to corresponding positions.
10. (Optional) You can omit entering path/to/project if you prefer to copy the resulting icons manually
2. Done! Icons are copied to your project’s **images.xcassets** folder.
3. If upgrading from previous versions of icon generators, in *xCode*, navigate to **images.xcassets** folder in Project Navigator and move icon files to corresponding positions.
4. (Optional) You can omit entering path/to/project if you prefer to copy the resulting icons manually
# Iconset generator script
# usage: generate_iconset.sh ~/Projects/ios/destination/project/folder
# usage: generate_iconset.sh ~/Projects/ios/destination/Appicon.iconset ~/Downloads/sourceIcon_v2.png
mkdir -p iconset
rm iconset/*
if [ -z "$2" ]; then
# $2 is empty
sourceIcon="sourceIcon.png"
else
sourceIcon="$2"
fi
#iPhone icons
sips -Z 40 --out iconset/iphoneNotification-20pt@2x.png sourceIcon.png
sips -Z 60 --out iconset/iphoneNotification-20pt@3x.png sourceIcon.png
sips -Z 58 --out iconset/iphoneSettings-29pt@2x.png sourceIcon.png
sips -Z 87 --out iconset/iphoneSettings-29pt@3x.png sourceIcon.png
sips -Z 80 --out iconset/iphoneSpotlight-40pt@2x.png sourceIcon.png
sips -Z 120 --out iconset/iphoneSpotlight-40pt@3x.png sourceIcon.png
sips -Z 120 --out iconset/iphoneApp-60pt@2x.png sourceIcon.png
sips -Z 180 --out iconset/iphoneApp-60pt@3x.png sourceIcon.png
sips -Z 40 --out iconset/iphoneNotification-20pt@2x.png "$sourceIcon"
sips -Z 60 --out iconset/iphoneNotification-20pt@3x.png "$sourceIcon"
sips -Z 58 --out iconset/iphoneSettings-29pt@2x.png "$sourceIcon"
sips -Z 87 --out iconset/iphoneSettings-29pt@3x.png "$sourceIcon"
sips -Z 80 --out iconset/iphoneSpotlight-40pt@2x.png "$sourceIcon"
sips -Z 120 --out iconset/iphoneSpotlight-40pt@3x.png "$sourceIcon"
sips -Z 120 --out iconset/iphoneApp-60pt@2x.png "$sourceIcon"
sips -Z 180 --out iconset/iphoneApp-60pt@3x.png "$sourceIcon"
#iPad icons
sips -Z 20 --out iconset/ipadNotification-20pt.png sourceIcon.png
sips -Z 40 --out iconset/ipadNotification-20pt@2x.png sourceIcon.png
sips -Z 29 --out iconset/ipadSettings-29pt.png sourceIcon.png
sips -Z 58 --out iconset/ipadSettings-29pt@2x.png sourceIcon.png
sips -Z 40 --out iconset/ipadSpotlight-40pt.png sourceIcon.png
sips -Z 80 --out iconset/ipadSpotlight-40pt@2x.png sourceIcon.png
sips -Z 76 --out iconset/ipadApp-76pt.png sourceIcon.png
sips -Z 152 --out iconset/ipadApp-76pt@2x.png sourceIcon.png
sips -Z 167 --out iconset/ipadProApp-83.5@2x.png sourceIcon.png
sips -Z 20 --out iconset/ipadNotification-20pt.png "$sourceIcon"
sips -Z 40 --out iconset/ipadNotification-20pt@2x.png "$sourceIcon"
sips -Z 29 --out iconset/ipadSettings-29pt.png "$sourceIcon"
sips -Z 58 --out iconset/ipadSettings-29pt@2x.png "$sourceIcon"
sips -Z 40 --out iconset/ipadSpotlight-40pt.png "$sourceIcon"
sips -Z 80 --out iconset/ipadSpotlight-40pt@2x.png "$sourceIcon"
sips -Z 76 --out iconset/ipadApp-76pt.png "$sourceIcon"
sips -Z 152 --out iconset/ipadApp-76pt@2x.png "$sourceIcon"
sips -Z 167 --out iconset/ipadProApp-83.5@2x.png "$sourceIcon"
#App Store icon
cp sourceIcon.png iconset/appStore.png
cp "$sourceIcon" iconset/appStore.png
if [ -d $1 ]; then
echo "Copying to $1/Assets.xcassets/AppIcon.appiconset/"
cp iconset/*.png $1/Assets.xcassets/AppIcon.appiconset/
if [ -d "$1" ]; then
echo "Copying to $1"
cp iconset/*.png $1
fi
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment