Debian Codegraph @

package/svg2icns.sh

raw symbols SCIP
1 #!/bin/sh -x
2
3 # taken from https://gist.github.com/adriansr/1da9b18a8076b0f8a977a5eea0ae41ef
4 # run `brew install svg2png` to get svg2png
5 # iconutil comes from the Apple developer tools
6
7 set -e
8
9 SIZES="
10 16,16x16
11 32,16x16@2x
12 32,32x32
13 64,32x32@2x
14 128,128x128
15 256,128x128@2x
16 256,256x256
17 512,256x256@2x
18 512,512x512
19 1024,512x512@2x
20 "
21
22 for SVG in "$@"; do
23 BASE=$(basename "$SVG" | sed 's/\.[^\.]*$//')
24 ICONSET="$BASE.iconset"
25 mkdir -p "$ICONSET"
26 for PARAMS in $SIZES; do
27 SIZE=$(echo $PARAMS | cut -d, -f1)
28 LABEL=$(echo $PARAMS | cut -d, -f2)
29 svg2png -w $SIZE -h $SIZE "$SVG" "$ICONSET"/icon_$LABEL.png
30 done
31
32 iconutil -c icns "$ICONSET"
33 rm -rf "$ICONSET"
34 done