#!/usr/bin/env bash # Regenerate the app icons from assets/app-icon/pdfcraft.svg and the Windows PDF file icon # from assets/app-icon/pdfcraft-document.svg. Both are master vectors. # # Needs: resvg (brew install resvg / cargo install resvg) and python3 (stdlib only, for the .ico). # On macOS, iconutil also writes the .icns. The outputs are committed, so building and packaging # never need these tools. After running it, update the sha256 values in ATTRIBUTION.toml, then # `cargo xtask assets --write`. # # packaging/icons.sh set -euo pipefail ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" DIR="$ROOT/assets/app-icon" SVG="$DIR/pdfcraft.svg" ID="ai.storyteller.pdfcraft" TMP="$(mktemp -d)" trap 'rm -rf "$TMP"' EXIT command -v resvg >/dev/null || { echo "error: resvg not found (brew install resvg)" >&2; exit 1; } # The master is a full-bleed 512 tile (rx=112): right for Windows and Linux. macOS icons follow # Apple's grid instead: an 824 px body centred on a transparent 1024 canvas. MAC="$TMP/macos.svg" { echo '' echo '' echo '' } >"$MAC" render() { resvg -w "$2" -h "$2" "$1" "$3" II", b[16:24]) # IHDR entries += struct.pack("/dev/null; then SET="$TMP/pdfcraft.iconset" mkdir -p "$SET" for s in 16 32 128 256 512; do render "$MAC" "$s" "$SET/icon_${s}x${s}.png" render "$MAC" $((s * 2)) "$SET/icon_${s}x${s}@2x.png" done iconutil -c icns -o "$DIR/pdfcraft.icns" "$SET" else echo "warning: iconutil not found (macOS only); pdfcraft.icns not regenerated" >&2 fi echo "icons written to $DIR"