File: make_icon.sh

package info (click to toggle)
antimony 0.9.3-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 6,476 kB
  • sloc: cpp: 42,596; ansic: 28,661; python: 1,093; yacc: 128; lex: 114; sh: 90; makefile: 10
file content (40 lines) | stat: -rwxr-xr-x 845 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/bin/bash
set -e

INKPATH=(
    /Applications/Inkscape.app
    /opt/homebrew-cask/Caskroom/inkscape/0.48.5-2/Inkscape.app
    /opt/homebrew-cask/Caskroom/inkscape/0.91-1/Inkscape.app
)

for i in "${INKPATH[@]}"
do
    bin=$i/Contents/Resources/bin/inkscape
    if [ -e $bin ]; then
        INK=$bin
        break
    fi
done

if [ -z "$INK" ]; then
    echo "Could not find Inkscape executable."
    exit
fi

if [[ -z "$1" ]]
then
    echo "SVG file needed."
    exit
fi

BASE=`basename "$1" .svg`
DIR=`dirname "$1"`
SVG="$1"

$INK -z -D -e "$DIR/$BASE-16x.png" -f $SVG -w 16 -h 16
$INK -z -D -e "$DIR/$BASE-32x.png" -f $SVG -w 32 -h 32
$INK -z -D -e "$DIR/$BASE-128.png" -f $SVG -w 128 -h 128
$INK -z -D -e "$DIR/$BASE-256.png" -f $SVG -w 256 -h 256
$INK -z -D -e "$DIR/$BASE-512.png" -f $SVG -w 512 -h 512

png2icns sb.icns $DIR/$BASE-*.png