Brand-safe generative media: AI makes the scene, code makes it exact
Generative image, video and copy tooling where AI makes the scene but code applies everything that must be exact (typography, approved claims, mandatory wording), with people signing off at each decision.
Problem
A consumer-products creative team needed a steady flow of product images, short video ads, copy and concepts. Generative models produce attractive scenes quickly, but they garble lettering and labels, distort products, drift between shots, run up cost unpredictably, and cannot be trusted with text that must be exact, such as approved claims, mandatory wording and disclaimers. A single unapproved claim creates legal and platform-policy risk. Separately, a video team spent hours on repetitive rough-cut work for short social clips.
Goal
Speed up concept work and production while guaranteeing that everything which must be exact (brand typography, logos, label artwork, approved claims, mandatory wording, disclosures and running time) is applied by code identically every time, with people signing off at the decisions that matter and spend approved before it happens.
My role
Designed and built all five tools: the AI workspace's instructions and knowledge design, the deterministic compositor (in two matching implementations) and the concept generator; the chat render bot; the human-gated video ad workflow; the compliance-gated copy and prompt skill; and the natural-language video editor.
Solution
One principle across five tools: the AI generates the scene, and code applies anything that must be exact.
A product-imagery studio: a knowledge-grounded AI workspace turns briefs into on-brand generation prompts and concepts, and a deterministic compositor turns AI or studio shots into final frames by layering the real brand assets on in code.
A chat-native render bot: designers ask for images in team chat, and an agent loop chooses between the compositor and a reference-locked image model.
A human-gated video ad studio: product-grounded scenes, bookended clips, three human gates and spec-driven overlays.
A compliance-gated copy and prompt generator: whitelist-only copy, two human gates, and a rendering step that normalises and scans every string it emits.
A natural-language short-form video editor: one LLM call turns a sentence into a validated edit plan, and deterministic code transcribes, cuts, trims and renders.
How it works
Imagery studio and compositor.
A hosted AI project uses a system instruction and knowledge files (brand visual recipes, placement specs, approved statements and a scene-brief schema) to turn a short brief into image and video prompts, with modes for quick generation, designed content panels, a concept explorer and a full product image set. The model never writes text that must be exact.
Each frame is a layer spec (background, images, text, dividers and label warp) rendered as an HTML page and captured by headless Chrome, so fonts and layout come out identical every time.
Flat label artwork is warped onto the product with a homography (a perspective transform mapping the label's rectangle onto four target corners), applied as a CSS 3D matrix with subtle shading. A matching Python and Pillow implementation produces the same output server side, including product sets and a contact sheet.
A concept generator asks an LLM for more candidates than needed, each in a different predefined visual territory; a judging pass removes duplicates and returns the final set in a strict JSON schema.
Render bot.
The bot connects to team chat over a socket connection, so it needs no public endpoint.
Each thread gets an in-memory session with its history, the current reference image, a lock and the processed message identifiers, so duplicate deliveries are ignored.
An iteration-capped LLM agent loop has three tools: render one frame, render a product set with a contact sheet, and edit the current image. Scenes and edits come from an image model that receives the real product as a reference and is told to keep the label, logo, colours and shape identical, then pass through the compositor for text, so only one rendering engine exists.
Video ad studio.
Ground the product (a real product image and its dimensions) and classify it into a compliance category that decides which disclosures apply.
Generate a still key scene and lock it on approval (the first gate). Write a shot plan and run a cost check up front; nothing is spent on video until a person approves the plan and the cost (the second gate).
Generate each clip bookended by fixed first and last frames, so consecutive clips join without seams, then stitch them and extract seam frames for review of the final cut (the third gate).
Composite the required text in code from a JSON spec (claim cards, disclaimers, synthetic-performer disclosures and an end card). A moderation refusal stops the run and escalates to a person rather than rewording around it, and a person decides any retry.
Copy and prompt generator.
Read product identity and classification from a spreadsheet source of truth, and propose concepts, each screened by a script before a person sees it.
A person picks a concept. Copy is drafted only from a closed whitelist of approved claims, stops at a mandatory approval gate, and goes into a schema-validated per-product spec.
A deterministic rendering step outputs one image prompt per ad placement, with alt text and the basis for each claim. Every string is first normalised (case, Unicode forms, zero-width characters, spacing and look-alike letters); multi-word phrases match on a separator-stripped form and single words on word boundaries, so innocent words that contain a banned word inside them still pass. It fails closed.
Video editor.
A single LLM call with forced tool use returns an edit plan (aspect ratio, crop, filler and silence settings, caption style and target length), validated against a schema before anything runs.
Audio is transcribed on the device into word-level timestamps; a cut detector marks hesitation words and long pauses, pads and merges the cuts, and inverts them into segments to keep.
A target length is reached by trimming on a whole-frame grid, so no drift accumulates, and captions are rebuilt against the new timeline with aspect-aware safe zones.
Technical challenges
Guaranteeing exactness in a generative pipeline by separating what AI may invent from what code must apply.
Perspective-correct label placement without a graphics stack, and keeping the Node.js and Python implementations visually identical.
Keeping products faithful across independently generated shots, and joining clips seamlessly.
Controlling spend with a hard approval point before any video credit is used.
Defeating evasion tricks (look-alike characters, zero-width characters, spacing) without false positives, and stopping invented claims with a whitelist rather than a blacklist alone.
Handling moderation refusals safely.
Avoiding the collapse where an LLM returns ten variations of one idea.
Conversation continuity and duplicate event delivery in chat.
Exact timing after dozens of cuts (frame arithmetic), without over-cutting meaningful words.
Capabilities
- Brief-to-prompt generation grounded in brand specs
- Variety-enforced concept exploration
- Product image set rendering and contact sheets
- Deterministic compositing of fonts, logos, label artwork and mandatory wording
- Perspective label warp
- Plain-language image requests in chat with reference locking
- Product-grounded video generation with three human gates, an up-front cost check, seamless audio-preserving stitching and review frames
- Spec-driven disclaimers and disclosures
- Moderation escalation to a person
- Ad copy from a whitelist only, with fail-closed string scanning
- One paste-ready prompt per ad placement
- Natural-language rough cuts with filler and silence removal, reframing, captions and an exact target duration
Technology
Impact
Product-image and ad production moved from manual compositing and one-off generation to repeatable pipelines where brand and compliance content is correct by construction, spend is approved before it happens, and people decide only at the points that need judgement. The video editor turned a multi-step rough cut into one command, as a working internal prototype. No metrics are claimed.
Skills demonstrated
- Generative AI system design
- Prompt, knowledge and agent-skill engineering
- Deterministic rendering and perspective geometry
- Parity between two implementations
- Structured output from language models
- Compliance by design and rule-engine engineering
- Human-in-the-loop and cost-control design
- Chat bot engineering
- Video processing and timeline arithmetic
- Speech-to-text integration
- Model evaluation
Demo
PlannedOne scripted mock for a fictional craft hot-sauce brand, with an open-licence font and an invented logo, shown as stills rendered in advance. First, a scene image with the headline and a required disclaimer applied by code identically across three regenerated backgrounds. Then the compliance scanner on an invented claims list ("made with real chipotle" allowed, "world's hottest sauce" banned) catching the banned phrase disguised with a look-alike letter and a zero-width space, while an innocent word containing the same letters passes. No working compositor, label warp, frame set, video pipeline or editor is built for the demo.
Not built yet. A demo here uses only invented names and data.