Screenshots: 10-inch tablet set; guard against blank captures
The 7-inch roots capture was pure app background (Compose had not composed its first frame yet, though the system bars had drawn) so it measured as uniform. made-store-screenshots.sh now measures each capture and refuses to normalise a blank one.
|
After Width: | Height: | Size: 35 KiB |
|
After Width: | Height: | Size: 71 KiB |
|
After Width: | Height: | Size: 128 KiB |
|
After Width: | Height: | Size: 72 KiB |
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 31 KiB |
|
Before Width: | Height: | Size: 70 KiB After Width: | Height: | Size: 70 KiB |
|
Before Width: | Height: | Size: 58 KiB After Width: | Height: | Size: 58 KiB |
|
Before Width: | Height: | Size: 70 KiB After Width: | Height: | Size: 70 KiB |
@@ -34,6 +34,15 @@ esac
|
|||||||
status_px="${STATUS_BAR_PX:-$default_status}"
|
status_px="${STATUS_BAR_PX:-$default_status}"
|
||||||
nav_px="${NAV_BAR_PX:-$default_nav}"
|
nav_px="${NAV_BAR_PX:-$default_nav}"
|
||||||
|
|
||||||
|
# A headless AVD whose display has slept, or an app whose first frame has not composed yet,
|
||||||
|
# produces a screencap of pure background. The top and bottom system bars are still drawn,
|
||||||
|
# so the file is not *obviously* empty — but the app area has no ink at all. That is
|
||||||
|
# invisible in a thumbnail and unacceptable on a listing, so each capture is measured
|
||||||
|
# before it is normalised. `sample_inset` shaves the top and bottom margin (where the
|
||||||
|
# system bars sit on every profile here) so the measurement covers app content only.
|
||||||
|
blank_threshold="${BLANK_THRESHOLD:-0.005}"
|
||||||
|
sample_inset=150
|
||||||
|
|
||||||
raw="$repo/store-assets/raw-screenshots/$form"
|
raw="$repo/store-assets/raw-screenshots/$form"
|
||||||
out="$repo/store-assets/screenshots/$form"
|
out="$repo/store-assets/screenshots/$form"
|
||||||
mkdir -p "$out"
|
mkdir -p "$out"
|
||||||
@@ -47,8 +56,18 @@ if [ ${#captures[@]} -eq 0 ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Normalising ${#captures[@]} capture(s) from $raw -> $out"
|
echo "Normalising ${#captures[@]} capture(s) from $raw -> $out"
|
||||||
|
blanks=0
|
||||||
for capture in "${captures[@]}"; do
|
for capture in "${captures[@]}"; do
|
||||||
name="$(basename "$capture")"
|
name="$(basename "$capture")"
|
||||||
|
|
||||||
|
content_stddev="$(magick "$capture" -shave 0x"$sample_inset" \
|
||||||
|
-colorspace gray -format '%[fx:standard_deviation]' info:)"
|
||||||
|
if awk -v s="$content_stddev" -v t="$blank_threshold" 'BEGIN { exit !(s < t) }'; then
|
||||||
|
printf ' %s BLANK (content stddev %s) — not normalised\n' "$name" "$content_stddev" >&2
|
||||||
|
blanks=$((blanks + 1))
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
magick "$capture" \
|
magick "$capture" \
|
||||||
-gravity North -chop 0x"$status_px" \
|
-gravity North -chop 0x"$status_px" \
|
||||||
-gravity South -chop 0x"$nav_px" \
|
-gravity South -chop 0x"$nav_px" \
|
||||||
@@ -60,4 +79,12 @@ for capture in "${captures[@]}"; do
|
|||||||
magick identify -format '%wx%h %[channels] %b\n' "$out/$name"
|
magick identify -format '%wx%h %[channels] %b\n' "$out/$name"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
if [ "$blanks" -gt 0 ]; then
|
||||||
|
echo "ERROR: $blanks capture(s) were blank and are missing from $out." >&2
|
||||||
|
echo " Wake the display and wait for the app's first frame, then re-capture:" >&2
|
||||||
|
echo " adb shell svc power stayon true" >&2
|
||||||
|
echo " adb shell input keyevent KEYCODE_WAKEUP" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
echo "Done."
|
echo "Done."
|
||||||
|
|||||||