#!/usr/bin/env bash # Generates all icon assets for bincio-rec. # Requires ImageMagick 7 (magick). # # Centering strategy: both letters are rendered with -gravity Center. # Each letter's centre is offset ±HALF pixels from the canvas centre, # where HALF = (letter_width + gap) / 2. This gives mathematically # correct horizontal & vertical centering regardless of font metrics. set -e cd "$(dirname "$0")/.." FONT="$HOME/Library/Fonts/NotoSans-Bold.ttf" BG="#09090b" WHITE="#ffffff" RED="#ef4444" # render_br CANVAS BG SIZE HALF OUT # HALF = how many pixels each letter centre is offset from canvas centre. render_br() { local CANVAS=$1 BG_COL=$2 SIZE=$3 HALF=$4 OUT=$5 magick -size "${CANVAS}x${CANVAS}" xc:"$BG_COL" \ -font "$FONT" -pointsize "$SIZE" -gravity Center \ -fill "$WHITE" -annotate "-${HALF}+0" 'B' \ -fill "$RED" -annotate "+${HALF}+0" 'R' \ "$OUT" } # render_br_transparent CANVAS SIZE HALF B_FILL R_FILL OUT render_br_transparent() { local CANVAS=$1 SIZE=$2 HALF=$3 B_FILL=$4 R_FILL=$5 OUT=$6 magick -size "${CANVAS}x${CANVAS}" xc:none \ -font "$FONT" -pointsize "$SIZE" -gravity Center \ -fill "$B_FILL" -annotate "-${HALF}+0" 'B' \ -fill "$R_FILL" -annotate "+${HALF}+0" 'R' \ "$OUT" } # At 480 pt NotoSans-Bold, each capital is ~320 px wide. # Gap between inner edges: 60 px. Inter-centre: 320 + 60 = 380 → HALF = 190. render_br 1024 "$BG" 480 190 assets/icon.png # Adaptive foreground (transparent, fits the 66% safe zone). # 320 pt → letter ~215 px wide. Gap 50 px → HALF = 132. render_br_transparent 1024 320 132 "$WHITE" "$RED" assets/android-icon-foreground.png render_br_transparent 1024 320 132 "$WHITE" "$WHITE" assets/android-icon-monochrome.png # Splash 512×512 — 240 pt → letter ~160 px wide. Gap 36 px → HALF = 98. render_br 512 "$BG" 240 98 assets/splash-icon.png echo "✓ Icon assets generated in assets/"