1
0
Fork 0
flightgear/package/svg2icns.sh
James Turner a25902e2a3 macOS: update ICNS file
Add SVG source icon created by Michael Danilov, and an SVG to ICNS
conversion script from GitHub which generates all the resolutions
and sizes nicely.
2020-12-12 16:39:04 +00:00

34 lines
704 B
Bash
Executable file

#!/bin/sh -x
# taken from https://gist.github.com/adriansr/1da9b18a8076b0f8a977a5eea0ae41ef
# run `brew install svg2png` to get svg2png
# iconutil comes from the Apple developer tools
set -e
SIZES="
16,16x16
32,16x16@2x
32,32x32
64,32x32@2x
128,128x128
256,128x128@2x
256,256x256
512,256x256@2x
512,512x512
1024,512x512@2x
"
for SVG in "$@"; do
BASE=$(basename "$SVG" | sed 's/\.[^\.]*$//')
ICONSET="$BASE.iconset"
mkdir -p "$ICONSET"
for PARAMS in $SIZES; do
SIZE=$(echo $PARAMS | cut -d, -f1)
LABEL=$(echo $PARAMS | cut -d, -f2)
svg2png -w $SIZE -h $SIZE "$SVG" "$ICONSET"/icon_$LABEL.png
done
iconutil -c icns "$ICONSET"
rm -rf "$ICONSET"
done