Files
miracles_in_motion/scripts/brand/export-brand-assets.sh
T
defiQUGandCursor 33aab0d3de Add brand kit, #/brand page, and responsive logo marks
Export script generates PNG/WebP/favicons/ZIP and OG image; nav uses symbol on mobile and horizontal lockup on desktop; press kit at #/brand with download links and print-friendly guidelines.

Co-authored-by: Cursor <[email protected]>
2026-05-26 20:53:37 -07:00

88 lines
3.2 KiB
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/env bash
# Generate web-ready brand assets and MIM4U-Brand-Kit.zip from sources in assets/brand-sources/.
# Requires: ImageMagick (convert). Run from repo root: ./scripts/brand/export-brand-assets.sh
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
MIM_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
SRC="$MIM_ROOT/assets/brand-sources"
OUT="$MIM_ROOT/public/brand"
PUBLIC="$MIM_ROOT/public"
GREEN="#1a3c34"
if ! command -v convert >/dev/null 2>&1; then
echo "Error: ImageMagick convert is required." >&2
exit 1
fi
mkdir -p "$OUT"
symbol="$SRC/logo-symbol-source.png"
horizontal="$SRC/logo-horizontal-source.png"
square="$SRC/logo-square-source.png"
for f in "$symbol" "$horizontal" "$square"; do
if [[ ! -f "$f" ]]; then
echo "Missing source: $f" >&2
exit 1
fi
done
echo "Exporting symbol PNG sizes..."
for size in 64 128 256 512 1024; do
convert "$symbol" -resize "${size}x${size}" -strip "$OUT/logo-symbol-${size}.png"
done
cp "$OUT/logo-symbol-512.png" "$OUT/logo-symbol.png"
echo "Exporting horizontal PNG/WebP..."
convert "$horizontal" -strip "$OUT/logo-horizontal.png"
convert "$horizontal" -quality 88 -define webp:method=6 "$OUT/logo-horizontal.webp"
convert "$horizontal" -resize 2048x -strip "$OUT/logo-horizontal-2x.png"
echo "Exporting square PNG/WebP..."
convert "$square" -strip "$OUT/logo-square.png"
convert "$square" -quality 88 -define webp:method=6 "$OUT/logo-square.webp"
echo "Exporting favicon / touch icons (symbol on brand green)..."
for size in 16 32 180 192 512; do
convert "$symbol" -background "$GREEN" -gravity center -resize "${size}x${size}" -extent "${size}x${size}" -strip "$OUT/favicon-${size}.png"
done
# Multi-size favicon.ico
convert "$OUT/favicon-16.png" "$OUT/favicon-32.png" "$OUT/favicon.ico"
# Root copies for site + PWA
cp "$OUT/logo-horizontal.png" "$PUBLIC/logo-horizontal.png"
cp "$OUT/logo-square.png" "$PUBLIC/logo.png"
cp "$OUT/logo-symbol.png" "$PUBLIC/logo-symbol.png"
cp "$OUT/favicon-16.png" "$PUBLIC/favicon-16x16.png"
cp "$OUT/favicon-32.png" "$PUBLIC/favicon-32x32.png"
cp "$OUT/favicon-180.png" "$PUBLIC/apple-touch-icon.png"
cp "$OUT/favicon-192.png" "$PUBLIC/favicon-192x192.png"
cp "$OUT/favicon-512.png" "$PUBLIC/favicon-512x512.png"
cp "$OUT/favicon.ico" "$PUBLIC/favicon.ico"
echo "Generating OG social image (1200×630)..."
convert "$horizontal" -resize 1200x630^ -gravity center -extent 1200x630 -strip "$OUT/og-image.png"
cp "$OUT/og-image.png" "$PUBLIC/og-image.png" 2>/dev/null || cp "$OUT/og-image.png" "$PUBLIC/og-image.jpg" 2>/dev/null || true
if [[ -f "$PUBLIC/og-image.jpg" ]]; then
convert "$OUT/og-image.png" -quality 90 "$PUBLIC/og-image.jpg"
fi
echo "Building brand kit ZIP..."
(
cd "$OUT"
rm -f MIM4U-Brand-Kit.zip
zip -q MIM4U-Brand-Kit.zip \
logo-symbol.svg \
logo-symbol.png logo-symbol-64.png logo-symbol-128.png logo-symbol-256.png logo-symbol-512.png logo-symbol-1024.png \
logo-horizontal.png logo-horizontal.webp logo-horizontal-2x.png \
logo-square.png logo-square.webp \
favicon.ico favicon-16.png favicon-32.png favicon-180.png favicon-192.png favicon-512.png \
og-image.png \
BRAND_GUIDELINES.md 2>/dev/null || true
)
echo "Done. Outputs: $OUT"