lokinet/contrib/make-ico.sh
Jason Rhinelander 25d73d627a
Remake non-mac icon; regenerate during build for windows
The non-mac icon was an old version with white foreground and a
completely transparent background, but this looks bad (or invisible)
depending on where you view it.  This updates it based on the macos
icon, but with a round white circle background instead of the macos
"squircle" background.

This also replaces the .ico file for the installer with one that we
build during the win32 build rather than a pregenerated one.

Bumps the gui as well to a version with the new icons in place.
2022-10-06 21:32:58 -03:00

29 lines
938 B
Bash
Executable File

#!/bin/bash
# Invoked from cmake as make-ico.sh /path/to/icon.svg /path/to/output.ico
svg="$1"
out="$2"
outdir="$out.d"
set -e
sizes=(16 24 32 40 48 64 96 192 256)
outs=""
mkdir -p "${outdir}"
for size in "${sizes[@]}"; do
outf="${outdir}/${size}x${size}.png"
if [ $size -lt 32 ]; then
# For 16x16 and 24x24 we crop the image to 3/4 of its regular size before resizing and make
# it all white (instead of transparent) which effectively zooms in on it a bit because if we
# resize the full icon it ends up a fuzzy mess, while the crop and resize lets us retain
# some detail of the logo.
convert -background white -resize 512x512 "$svg" -gravity Center -extent 320x320 -resize ${size}x${size} -strip "png32:$outf"
else
convert -background transparent -resize ${size}x${size} "$svg" -strip "png32:$outf"
fi
outs="-r $outf $outs"
done
icotool -c -b 32 -o "$out" $outs