scenario-text-overlay
Scenario Text Overlay
Overview
Generation models drift on type, so text that must be exact is rendered deterministically here and
composited over the media. One JSON payload describes one overlay, in one of two kinds: a text layer
(plain styled text in a box) or a rich layer (HTML/CSS typography: gradients, strokes, shadows, card
layouts). Both substitute Mustache {{variables}} strictly (a missing variable fails the render) on
a transparent canvas.
scripts/overlay.py renders the payload to a PNG with an installed
Chromium-family browser (both kinds, discovered automatically) or a Pillow fallback (text layers
only), embeds the payload JSON into the PNG, and prints the path. Its modules:
scripts/templating.py (strict Mustache),
scripts/html_render.py (browser engine),
scripts/pillow_render.py (fallback). The field-by-field contract and
example payloads live in references/payloads.md. The script needs
pip install chevron pillow.