Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- #
- # name:
- # mkicon.sh
- #
- # Generates icon images from original file
- # The original image should be larger than 1024x1024 in pixel
- #
- # parameters:
- # $1:original file
- # $2:mac/ios
- #
- # dependencies:
- # sips
- #
- if [ $# -ne 2 ];then
- echo give me an original file and mac/ios
- exit 1
- fi
- org=$1
- target=$2
- if [ ! -f $org ];then
- echo file not found: $org
- exit 1
- fi
- OLD_IFS=$IFS
- IFS='.'
- set -- $org
- prefix=$1
- suffix=$2
- IFS=$OLD_IFS
- case $target in
- "mac" ) sizes=(16 32 64 128 256 512 1024);;
- "ios" ) sizes=(29 58 87 76 152 60 120 180 \
- 40 80 120 72 144 50 100 57 \
- 114 512 1024);;
- esac
- for i in ${sizes[@]}
- do
- f=${prefix}_${i}.${suffix}
- cp $org $f
- sips -Z $i $f
- done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement