File: make_icns.sh

package info (click to toggle)
nvpy 2.3.1-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 2,460 kB
  • sloc: python: 4,870; makefile: 37; sh: 11
file content (18 lines) | stat: -rwxr-xr-x 451 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/bin/zsh

# script made by SO user dardo82
# http://stackoverflow.com/a/31150333/532513
# we use this to create the mac-required .ICNS icons file

NAME=$(basename $1 .png); DIR="$NAME.iconset"
mkdir -pv $DIR
for m r in 'n' '' '((n+1))' '@2x'; do
    for n in $(seq 4 9 | grep -v 6); do
        p=$((2**$m)); q=$((2**$n))
        OUT="$DIR/icon_${q}x${q}${r}.png"
        sips -z $p $p $1 --out $OUT
    done
done
iconutil -c icns $DIR
rm -frv $DIR