4 BASENAME=${FILENAME512%-512.png}
7 echo "$(basename "$0") <LOGO_NAME>-512.png"
10 [ "$1" = "-h" ] && usage && exit 0
11 [ -r "$FILENAME512" ] || ( usage && echo "'${FILENAME512}' must exist and be readable" && exit 1 )
12 [ "$BASENAME" = "$FILENAME512" ] && usage && echo "Must have '-512.png' at end of filename" && exit 2
16 SIZES="16 32 38 48 64 128 256"
17 declare -a ICOFILES=()
18 declare -a ICNSFILES=()
21 NEWFILE="${BASENAME}-${n}.png"
22 [ -e "{$NEWFILE}" ] && continue
23 convert -geometry "${n}x${n}" "${BASENAME}-512.png" "${NEWFILE}"
24 [ "${n}" != 38 ] && ICOFILES=( "${ICOFILES[@]}" "${NEWFILE}" )
25 [ "${n}" != 64 ] && [ "${n}" != 38 ] && ICNSFILES=( "${ICNSFILES[@]}" "${NEWFILE}" )
29 ICOFILE="${BASENAME}.ico"
30 echo "Creating ${ICOFILE}"
31 convert "${ICOFILES[@]}" "${ICOFILE}"
34 ICNSFILE="${BASENAME}.icns"
35 echo "Creating ${ICNSFILE}"
36 png2icns "${ICNSFILE}" "${ICNSFILES[@]}"
38 # make the rotatable icon
39 ROTATABLEFILE="rotatable_${BASENAME}-38.png"
40 convert "${BASENAME}-38.png" -gravity center -background white -extent 60x60 "${ROTATABLEFILE}"