Files
SoftwareApp 5cb7ad66a8 feat: make the store-screenshot normaliser form-factor aware
Play gives phones and each tablet size a screenshot slot of their own (Phone, 7-inch
tablet, 10-inch tablet) and asks for at least four screenshots per large-screen form
factor, so the normaliser takes FORM_FACTOR=phone|tablet-7in|tablet-10in and keeps one
raw and one output directory per factor:

  store-assets/raw-screenshots/<form-factor>/   adb captures (git-ignored)
  store-assets/screenshots/<form-factor>/       what gets uploaded

The tablet form factors crop 0 px of system chrome on purpose, and that is checked
rather than guessed: every tablet profile in the SDK's own device definitions is already
inside Play's 2:1 cap (7in WSVGA 1024x600, 10.1in WXGA 1280x800, Nexus 7 2013
1200x1920, and Nexus 10 / Medium Tablet / Pixel Tablet at 2560x1600), so the 93/130 px
phone crop exists only because a 1080x2400 phone frame is 2.22:1. Cropping a tablet is
therefore cosmetic, and is now opt-in through STATUS_BAR_PX / NAV_BAR_PX.

The 2:1 clamp still runs for every form factor, and each file is now checked against
Play's limits as it is written (shorter side >= 320 px, longer side <= 3840 px) - the
phone captures only ever got that check by hand. A missing input directory or an unknown
form factor now fails with an actionable message instead of a bash error.

The four existing phone captures move to raw-screenshots/phone/ and normalise to the
same 1080x2160 RGB files as before, byte for byte. The 7-inch and 10-inch captures were
taken with this script on AOSP AVDs; how, and the numbers they show, are recorded in
docs/STORE_LISTING.md.

tools/make-store-assets.sh now prints the two tablet invocations as well, so the obvious
next step after generating the icon and feature graphic is not the phone-only one.
2026-10-14 09:48:49 +02:00

44 lines
2.1 KiB
Bash
Executable File

#!/usr/bin/env bash
#
# Generates the Google Play store graphics from the app's own icon vectors.
#
# ./tools/make-store-assets.sh [output-dir] # default: ./store-assets
#
# Produces, matching Play's asset specs (support.google.com/.../answer/9866151):
# icon-512.png 512 x 512 32-bit PNG *with* alpha (ours is full-bleed,
# so every pixel ends up opaque anyway)
# feature-graphic-1024x500.png 1024 x 500 24-bit PNG, no alpha
#
# Output lands in ./store-assets/ *inside* the repo, never in $HOME: the editable sources are
# the SVGs in tools/store-assets/ and these PNGs are the files that get uploaded to the Play
# Console, so they belong with the release they were made for. Pass a directory to override.
set -euo pipefail
here="$(cd "$(dirname "$0")" && pwd)"
repo="$(dirname "$here")"
out="${1:-$repo/store-assets}"
mkdir -p "$out"
render() { # <svg> <width> <height> <filename> <keep-alpha|flatten>
local svg="$1" width="$2" height="$3" name="$4" mode="$5"
inkscape "$svg" \
--export-type=png --export-width="$width" --export-height="$height" \
--export-filename="$out/$name" >/dev/null 2>&1
if [ "$mode" = keep-alpha ]; then
# Play asks for a 32-bit PNG here. The SVG's background rect covers the whole
# canvas, so the alpha channel is fully opaque — no accidental transparency.
magick "$out/$name" -alpha on PNG32:"$out/$name"
else
magick "$out/$name" -background '#1B5E20' -alpha remove -alpha off PNG24:"$out/$name"
fi
printf ' %s ' "$out/$name"
identify -format '%wx%h %[channels] %b\n' "$out/$name"
}
echo "Writing store assets to $out"
render "$here/store-assets/icon.svg" 512 512 icon-512.png keep-alpha
render "$here/store-assets/feature-graphic.svg" 1024 500 feature-graphic-1024x500.png flatten
echo "Done. Screenshots: ./tools/make-store-screenshots.sh # reads store-assets/raw-screenshots/phone/"
echo " Tablets: FORM_FACTOR=tablet-7in ./tools/make-store-screenshots.sh"
echo " FORM_FACTOR=tablet-10in ./tools/make-store-screenshots.sh"