Files
foto-duplicate-finder-free/tools/make-store-assets.sh
T
SoftwareApp 7b92da4f8b feat: give Google Ads the App campaign layer, costed against what a sale pays
docs/AD_COPY.md is the new home for the ad copy: five headlines (30 characters) and five
descriptions (90 each), five spares of each for rotation, and the rule that decides the wording —
the app is paid, so "free" cannot appear, and the creatives therefore say "No ads. No uploads.
Fully offline." rather than "Ad-free". The doc checks itself: a python block reads its own tables
and asserts each count and cap, verified against a deliberately over-length row (31 characters with
a stale count) before it was trusted.

It also records the arithmetic the campaign has to clear, because the Console hides it: the price
entered there is *net* and the buyer is charged VAT on top. The live listing reads EUR 3.59 with the
sale at EUR 1.79 — 2.99 x 1.20 and 1.49 x 1.20, the 20% column — where the documents had predicted
only the German 19% figures of 3.56 and 1.77. STORE_LISTING now separates the two numbers, says
which one the strikethrough shows (the gross one, not the EUR 2.99 typed in), and quantifies making
EUR 2.99 the sticker: the tax comes out of the developer's share, so EUR 2.54 a sale becomes
EUR 2.14. PLAY_RELEASE_CHECKLIST carries the correction at the step that enters the price.

For a paid app the install *is* the purchase, so the ceiling is the net per sale — EUR 2.54 at base,
EUR 1.27 during the launch sale — and a target of EUR 0.16 is not a target but a delivery stop: it
implies a 16x return on ad spend that no auction clears. The doc recommends Maximise conversions
first, a EUR 5/day budget sized by what a wrong answer costs, an in-market or custom-segment
audience only if one is wanted at all, and stop/scale rules for the week after. HTML5 last, text,
images and video first — Google's own guidance, quoted.

tools/make-store-assets.sh now renders that image set — 1200x628, 1200x1200, 320x480 — from three
new SVG sources that reuse the icon motif and gradient of icon.svg and feature-graphic.svg verbatim
and embed the committed 03-results screenshot. Two of its checks exist because the first versions
were wrong: comparing the finished PNG with the requested size can never fail, since
--export-width forces it, so the check moved to the *declared* canvas (a sandbox edit to 1200x600
now fails loudly), and --export-area-page is pinned because the cards bleed — the drawing bbox is
1200x710, which an older Inkscape would have squashed into the page. -strip drops the tIME Inkscape
stamps on every render, so two consecutive runs are byte-identical and a rebuild leaves no fake diff
(measured: 0 differing pixels with and without it).

The SVGs are sources, not uploads — Google Ads rejects SVG — so each says so in its header and the
script prints which PNGs to upload. store-assets/app-campaign/ holds those: 8-bit RGB, no alpha.

README points at both the new doc and the new output. No CHANGELOG entry: none of this is an app
change.
2026-10-15 18:02:44 +02:00

135 lines
7.3 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
#
# and the Google Ads *App campaign* image set, one per orientation, in app-campaign/:
# landscape-1200x628.png 1200 x 628 1.91:1 horizontal placements
# square-1200x1200.png 1200 x 1200 1:1 feed / interstitial
# portrait-320x480.png 320 x 480 2:3 vertical placements
#
# The three ad creatives are not scaled copies of one file: Google Ads matches an asset to the
# placement's orientation, so one landscape image leaves the portrait and square slots empty.
# They embed store-assets/screenshots/phone/03-results.png, so run make-store-screenshots.sh
# first if that file is missing — the check below says so instead of rendering an empty hole.
#
# 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
# --- Google Ads App campaign creatives ---------------------------------------------------------
# One file per orientation, and each is composed rather than resized: an asset is matched to a
# placement's orientation, so three honest layouts beat twenty near-duplicates. 5 MB is the size the
# Google Ads image uploader accepts, so an oversized file is flagged here instead of at upload time.
ad_max_bytes=$((5 * 1024 * 1024))
shot="$repo/store-assets/screenshots/phone/03-results.png"
if [ ! -f "$shot" ]; then
echo "error: $shot is missing — all three App campaign creatives embed it." >&2
echo " ./tools/make-store-screenshots.sh # builds it from store-assets/raw-screenshots/phone/" >&2
exit 2
fi
ad_out="$out/app-campaign"
mkdir -p "$ad_out"
render_ad() { # <svg> <width> <height> <filename>
local svg="$1" width="$2" height="$3" name="$4"
# Check the *declared* canvas, not the finished file. --export-width/height forces the output
# size, so measuring the PNG and comparing it with those two numbers would pass every time —
# including for a source edited to a different canvas, which the export flags would then stretch
# into the size the Console asked for. This is the check that catches that.
local root declared_width declared_height
root="$(tr -d '\n' < "$svg" | grep -o '<svg[^>]*>' | head -1)"
declared_width="$(printf '%s' "$root" | grep -oE 'width="[0-9]+"' | head -1 | tr -dc '0-9')"
declared_height="$(printf '%s' "$root" | grep -oE 'height="[0-9]+"' | head -1 | tr -dc '0-9')"
if [ "$declared_width" != "$width" ] || [ "$declared_height" != "$height" ]; then
echo "error: $svg declares ${declared_width}x${declared_height} but is rendered at ${width}x${height}" >&2
echo " that would stretch the composition — fix the SVG or the size in this script" >&2
exit 1
fi
# --export-area-page is explicit rather than implied, because these three bleed: the screenshot
# card is cut by the canvas edge, so the drawing bbox is taller than the page (1200x710 for the
# landscape one). Inkscape 1.x already exports the page here — checked pixel-identical with and
# without the flag, 0 differing pixels — but 0.92 defaulted to the drawing bbox, which would
# rescale this whole composition into 1200x628 and squash it.
inkscape "$svg" \
--export-type=png --export-area-page \
--export-width="$width" --export-height="$height" \
--export-filename="$ad_out/$name" >/dev/null 2>&1
# Flatten against the brand colour: an ad is shown on the placement's own background, so an
# alpha channel is how a stray transparent pixel ends up in something a customer sees.
# -strip follows from the timestamp problem: Inkscape stamps every fresh render with tIME, so
# without it a re-run of this script is pixel-identical but byte-different, and every build
# would leave three "modified" files in git. Stripping is metadata-only — measured 0 differing
# pixels with and without it.
magick "$ad_out/$name" -background '#1B5E20' -alpha remove -alpha off -strip \
PNG24:"$ad_out/$name"
# And the finished file, because an Inkscape old enough to ignore --export-width would write the
# page size here instead — which the declared-canvas check above cannot see.
local got_width got_height
got_width="$(identify -format '%w' "$ad_out/$name")"
got_height="$(identify -format '%h' "$ad_out/$name")"
if [ "$got_width" != "$width" ] || [ "$got_height" != "$height" ]; then
echo "error: $name came out ${got_width}x${got_height}, expected ${width}x${height}" >&2
echo " check the width/height and viewBox in $svg" >&2
exit 1
fi
local warn=''
if [ "$(identify -format '%B' "$ad_out/$name")" -gt "$ad_max_bytes" ]; then
warn=' ⚠️ over the 5 MB image limit — re-encode before uploading'
fi
printf ' %s ' "$ad_out/$name"
identify -format '%wx%h %[channels] %b' "$ad_out/$name"
printf '%s\n' "$warn"
}
echo "App campaign images (Google Ads), shot embedded: $shot"
render_ad "$here/store-assets/app-campaign-landscape.svg" 1200 628 landscape-1200x628.png
render_ad "$here/store-assets/app-campaign-square.svg" 1200 1200 square-1200x1200.png
render_ad "$here/store-assets/app-campaign-portrait.svg" 320 480 portrait-320x480.png
echo "Done. Play: icon-512.png + feature-graphic-1024x500.png"
echo " Ads: app-campaign/landscape-1200x628.png, square-1200x1200.png, portrait-320x480.png"
echo " ^ upload these PNGs; the tools/store-assets/*.svg are sources, and Ads rejects SVG"
echo " 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"