Add low-res icon QA exports
Some checks failed
Build Rust / Cargo Test (push) Successful in 4m2s
Build Site / Next.js Build (push) Failing after 4s
Lint Governance / BEP Metadata (push) Successful in 1s

This commit is contained in:
Conrad Kramer 2026-06-07 22:18:06 -07:00
parent 6c169f6b45
commit 7ded0e2e69
26 changed files with 135 additions and 0 deletions

View file

@ -0,0 +1,108 @@
#!/usr/bin/env bash
set -euo pipefail
repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
cd "$repo_root"
ictool="/Applications/Xcode/Xcode.app/Contents/Applications/Icon Composer.app/Contents/Executables/ictool"
icon_doc="$repo_root/design/brand/Burrow.icon"
output_dir_arg="${1:-design/brand/low-res}"
if [[ "$output_dir_arg" = /* ]]; then
output_dir="$output_dir_arg"
else
output_dir="$repo_root/$output_dir_arg"
fi
master="$output_dir/burrow-icon-1024.png"
checked_in_master="$repo_root/design/brand/burrow-owl-icon-master.png"
source_master="$checked_in_master"
sizes=(16 20 24 29 32 40 48 64 80 128 256)
require_tool() {
if ! command -v "$1" >/dev/null 2>&1; then
echo "error: required tool not found: $1" >&2
exit 127
fi
}
require_tool magick
require_tool awk
if [[ ! -x "$ictool" ]]; then
echo "error: Icon Composer ictool not found at $ictool" >&2
exit 127
fi
mkdir -p "$output_dir"
if [[ "${BURROW_ICON_REFRESH:-0}" == "1" ]]; then
if ! "$ictool" "$icon_doc" \
--export-image \
--output-file "$master" \
--platform iOS \
--rendition Default \
--width 1024 \
--height 1024 \
--scale 1 >/dev/null; then
echo "warning: ictool could not export $icon_doc; falling back to $checked_in_master" >&2
magick "$checked_in_master" -colorspace sRGB -strip "PNG24:$master"
source_master="$checked_in_master"
else
source_master="$master"
fi
else
magick "$checked_in_master" -colorspace sRGB -strip "PNG24:$master"
fi
printf "size,colors,gray_stddev,status\n" >"$output_dir/report.csv"
for size in "${sizes[@]}"; do
image="$output_dir/burrow-icon-${size}.png"
magick "$source_master" -colorspace sRGB -resize "${size}x${size}!" -strip "PNG24:$image"
actual="$(magick "$image" -format "%wx%h" info:)"
if [[ "$actual" != "${size}x${size}" ]]; then
echo "error: $image rendered as $actual, expected ${size}x${size}" >&2
exit 1
fi
colors="$(magick "$image" -format "%k" info:)"
stddev="$(magick "$image" -colorspace Gray -format "%[fx:standard_deviation]" info:)"
min_colors=$((size * 4))
if (( min_colors < 48 )); then
min_colors=48
fi
if (( min_colors > 900 )); then
min_colors=900
fi
awk -v size="$size" -v colors="$colors" -v min_colors="$min_colors" -v stddev="$stddev" '
BEGIN {
if (colors < min_colors) {
printf "error: %dpx icon has only %d colors; expected at least %d\n", size, colors, min_colors > "/dev/stderr";
exit 1;
}
if (stddev < 0.08) {
printf "error: %dpx icon grayscale stddev is %.6f; expected at least 0.08\n", size, stddev > "/dev/stderr";
exit 1;
}
}
'
printf "%s,%s,%s,ok\n" "$size" "$colors" "$stddev" >>"$output_dir/report.csv"
done
preview_inputs=()
for size in 256 128 80 64 48 40 32 29 20 16; do
preview="$output_dir/preview-${size}.png"
if (( size <= 20 )); then
filter=Point
else
filter=Lanczos
fi
magick "$output_dir/burrow-icon-${size}.png" -filter "$filter" -resize 128x128 "$preview"
preview_inputs+=("$preview")
done
magick -background "#202020" -gravity center "${preview_inputs[@]}" +append "$output_dir/preview-strip.png"
echo "low-res icon exports written to $output_dir"

View file

@ -46,3 +46,18 @@ for f in Apple/UI/Assets.xcassets/AppIcon.appiconset/*.png; do
magick design/brand/burrow-owl-icon-master.png -colorspace sRGB -resize "${size}x${size}!" -strip "PNG24:$f"
done
```
Run low-resolution export QA with:
```bash
Scripts/check-brand-icon-lowres.sh
```
The script writes `design/brand/low-res/`, including:
- `burrow-icon-{16,20,24,29,32,40,48,64,80,128,256}.png`
- `preview-strip.png`, a 256-to-16px visual strip scaled up for inspection
- `report.csv`, with color-count and grayscale-contrast checks
Sizes that overlap `Apple/UI/Assets.xcassets/AppIcon.appiconset/` should remain
pixel-identical to the generated app catalog assets.

Binary file not shown.

After

Width:  |  Height:  |  Size: 483 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 573 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 791 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 989 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 122 KiB

View file

@ -0,0 +1,12 @@
size,colors,gray_stddev,status
16,169,0.104705,ok
20,229,0.0961543,ok
24,300,0.0875631,ok
29,396,0.0974807,ok
32,446,0.0871776,ok
40,627,0.122803,ok
48,792,0.126094,ok
64,1198,0.142225,ok
80,1509,0.155485,ok
128,2577,0.171217,ok
256,4464,0.185023,ok
1 size colors gray_stddev status
2 16 169 0.104705 ok
3 20 229 0.0961543 ok
4 24 300 0.0875631 ok
5 29 396 0.0974807 ok
6 32 446 0.0871776 ok
7 40 627 0.122803 ok
8 48 792 0.126094 ok
9 64 1198 0.142225 ok
10 80 1509 0.155485 ok
11 128 2577 0.171217 ok
12 256 4464 0.185023 ok