Add low-res icon QA exports
108
Scripts/check-brand-icon-lowres.sh
Executable 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"
|
||||||
|
|
@ -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"
|
magick design/brand/burrow-owl-icon-master.png -colorspace sRGB -resize "${size}x${size}!" -strip "PNG24:$f"
|
||||||
done
|
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.
|
||||||
|
|
|
||||||
BIN
design/brand/low-res/burrow-icon-1024.png
Normal file
|
After Width: | Height: | Size: 483 KiB |
BIN
design/brand/low-res/burrow-icon-128.png
Normal file
|
After Width: | Height: | Size: 12 KiB |
BIN
design/brand/low-res/burrow-icon-16.png
Normal file
|
After Width: | Height: | Size: 573 B |
BIN
design/brand/low-res/burrow-icon-20.png
Normal file
|
After Width: | Height: | Size: 791 B |
BIN
design/brand/low-res/burrow-icon-24.png
Normal file
|
After Width: | Height: | Size: 989 B |
BIN
design/brand/low-res/burrow-icon-256.png
Normal file
|
After Width: | Height: | Size: 31 KiB |
BIN
design/brand/low-res/burrow-icon-29.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
design/brand/low-res/burrow-icon-32.png
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
BIN
design/brand/low-res/burrow-icon-40.png
Normal file
|
After Width: | Height: | Size: 2.1 KiB |
BIN
design/brand/low-res/burrow-icon-48.png
Normal file
|
After Width: | Height: | Size: 2.8 KiB |
BIN
design/brand/low-res/burrow-icon-64.png
Normal file
|
After Width: | Height: | Size: 4.3 KiB |
BIN
design/brand/low-res/burrow-icon-80.png
Normal file
|
After Width: | Height: | Size: 5.9 KiB |
BIN
design/brand/low-res/preview-128.png
Normal file
|
After Width: | Height: | Size: 14 KiB |
BIN
design/brand/low-res/preview-16.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
design/brand/low-res/preview-20.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
design/brand/low-res/preview-256.png
Normal file
|
After Width: | Height: | Size: 16 KiB |
BIN
design/brand/low-res/preview-29.png
Normal file
|
After Width: | Height: | Size: 15 KiB |
BIN
design/brand/low-res/preview-32.png
Normal file
|
After Width: | Height: | Size: 15 KiB |
BIN
design/brand/low-res/preview-40.png
Normal file
|
After Width: | Height: | Size: 16 KiB |
BIN
design/brand/low-res/preview-48.png
Normal file
|
After Width: | Height: | Size: 16 KiB |
BIN
design/brand/low-res/preview-64.png
Normal file
|
After Width: | Height: | Size: 16 KiB |
BIN
design/brand/low-res/preview-80.png
Normal file
|
After Width: | Height: | Size: 16 KiB |
BIN
design/brand/low-res/preview-strip.png
Normal file
|
After Width: | Height: | Size: 122 KiB |
12
design/brand/low-res/report.csv
Normal 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
|
||||||
|