Files
faunosteo/logos/generate-sizes.sh
T
2026-05-27 07:15:44 +02:00

36 lines
1.1 KiB
Bash

#!/bin/bash
# Generate sized SVG variants from base files.
# Each base has only a viewBox — this script adds width/height.
cd "$(dirname "$0")"
# Horizontal: viewBox="65 398 1049 243" → aspect 1049:243
for size in 512 1024 2048; do
h=$(echo "$size * 243 / 1049" | bc)
sed "s|viewBox=|width=\"$size\" height=\"$h\" viewBox=|" \
horizontal.svg > "horizontal-${size}.svg"
done
# Stacked: viewBox="0 0 880 420" → aspect 880:420
for size in 512 1024 2048; do
h=$(echo "$size * 420 / 880" | bc)
sed "s|viewBox=|width=\"$size\" height=\"$h\" viewBox=|" \
stacked.svg > "stacked-${size}.svg"
done
# Two-line: viewBox="65 385 603 253" → aspect 603:253
for size in 512 1024 2048; do
h=$(echo "$size * 253 / 603" | bc)
sed "s|viewBox=|width=\"$size\" height=\"$h\" viewBox=|" \
twoline.svg > "twoline-${size}.svg"
done
# Icon: viewBox="60 400 220 224" → square (use larger dim)
for size in 512 1024 2048; do
sed "s|viewBox=|width=\"$size\" height=\"$size\" viewBox=|" \
icon.svg > "icon-${size}.svg"
done
echo "Generated 12 sized SVGs."
ls -la *-512.svg *-1024.svg *-2048.svg