krz/krz.sh
clone: git clone https://gitbay.org/krz/krz.sh.git
1#!/usr/bin/env bash
2# Regenerate the raster icons in static/ from the sources here.
3# macOS only: qlmanage rasterizes the svg, sips crops it.
4set -euo pipefail
5cd "$(dirname "$0")"
6
7out=../static
8tmp=$(mktemp -d)
9trap 'rm -rf "$tmp"' EXIT
10
11# qlmanage always renders square, so og.svg is authored 1200x1200 with the
12# 630-tall band centred, then cropped back to size afterwards.
13qlmanage -t -s 1200 -o "$tmp" og.svg >/dev/null
14sips -c 630 1200 "$tmp/og.svg.png" >/dev/null
15cp "$tmp/og.svg.png" "$out/og.png"
16
17qlmanage -t -s 180 -o "$tmp" touch.svg >/dev/null
18cp "$tmp/touch.svg.png" "$out/apple-touch-icon.png"
19
20echo "wrote $out/og.png and $out/apple-touch-icon.png"