JAL-3594 New way for build.gradle to override properties with channel based propertie...
[jalview.git] / utils / create_iconfiles.sh
1 #!/usr/bin/env bash
2
3 # given a list of differently sized png files with the size in the filename like this:
4 # myiconfile-16.png myiconfile-32.png myiconfile-48.png myiconfile-64.png myiconfile-128.png myiconfile-256.png myiconfile-512.png
5 # run
6 # create_iconfiles.sh myiconfile-*.png
7 # to create an ICO file (for Windows) myiconfile.ico and an ICNS file (for macOS) myiconfile.icns
8
9 BASENAME=${1%-*}
10 if [ x$BASENAME = x ]; then
11   echo "Could not calculate basename from '${1}'"
12   exit 1
13 fi
14
15 ICOFILE=${BASENAME}.ico
16 echo "Creating ${ICOFILE}"
17 convert $* ${ICOFILE}
18
19 ICNSFILE=${BASENAME}.icns
20 echo "Creating ${ICNSFILE}"
21 # dont' include 64x64 icon (for some reason they're not allowed in icns file)
22 ICNSARGS=""
23 for ARG in $*; do
24   NUM=${ARG##*-}
25   NUM=${NUM%px*}
26   NUM=${NUM%x*}
27   NUM=${NUM%.*}
28   if [ x$NUM != x64 ]; then
29     ICNSARGS="${ICNSARGS} $ARG"
30   fi
31 done
32 png2icns ${ICNSFILE} ${ICNSARGS}