Last active
August 29, 2015 14:18
-
-
Save nonstriater/16fbcb07eae8eb310b5f to your computer and use it in GitHub Desktop.
Revisions
-
nonstriater renamed this gist
Apr 9, 2015 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
nonstriater renamed this gist
Apr 9, 2015 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
nonstriater created this gist
Apr 9, 2015 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,44 @@ #! /bin/bash ######################### # usage: iosicon.sh 1024-icon.png ######################### function print_usage(){ echo "################################" echo "usage: iosicon.sh <1024-icon.png>" echo "################################" } #check arg if [[ -z "$1" && $# -ne 1 ]]; then print_usage exit 1 fi # prepare ROOT_DIR=$(pwd) #check file exist SOURCE_FILE="${ROOT_DIR}/$1" if [[ ! -e ${SOURCE_FILE} ]]; then echo "source file not exist!" exit 2 fi DEST_DIR="${ROOT_DIR}/ios-icon" mkdir -p "${DEST_DIR}" ICON_ARRAY_NAME=("Icon-29.png" "[email protected]" "Icon-40.png" "[email protected]" "Icon.png" "[email protected]" "[email protected]" "[email protected]") ICON_ARRAY_SIZE=("29" "58" "40" "80" "57" "114" "120" "180") #sips starting cp "${SOURCE_FILE}" "${DEST_DIR}" for ((i=0; i<${#ICON_ARRAY_SIZE[@]} ;i++)); do size=${ICON_ARRAY_SIZE[i]} sips -Z ${size} "${SOURCE_FILE}" --out "${DEST_DIR}/${ICON_ARRAY_NAME[i]}" done