Image Generation and Editing in Products
Add text-to-image and image editing to an app: choosing a model, prompt templates for consistent results, storage, moderation, and licensing questions.
A text-to-image demo takes ten minutes to build: a text box, an API call, a picture. Shipping it is a different job. Real users type prompts you never imagined, every generation costs real money, the fifth image looks nothing like the first four, and somebody will eventually ask whether they own what came out. And image failures are visible: a distorted hand or a mangled logo ends up in a screenshot.
In this lesson you'll add image generation and editing to an app the way you'd ship any other feature: pick the job first, choose a model on your own test prompts, wrap user input in prompt templates that keep results consistent, store outputs properly, put moderation in front of the model, and know which licensing questions to ask before launch.
Decide what the image feature is for
"Add AI images" covers several very different features. Before choosing a model, decide which one you're building, because it changes who writes the prompt, how much control the user needs, and what failure looks like.
| Feature | Who writes the prompt | What "good" means | Example |
|---|---|---|---|
| Free-form generation | The user, mostly | Matches their intent; safe | A "create an image" button in a design tool |
| Templated generation | Your app, with a user-supplied slot | Consistent with a house style | Header illustrations for help articles |
| Editing | The user points at an image and describes a change | Changes only what was asked | Remove the background from a product photo |
| Variants | Your app, from an approved original | Recognizably the same asset | Ad creative in five aspect ratios |
Free-form generation is a commodity users already get from chat apps. Templated generation and editing are where your product adds value, because you supply context the user would otherwise have to type: your brand palette, the article's topic, the exact product photo.
For this lesson we'll build two features. Deskmate, the help-desk app used throughout the course, will generate header illustrations for knowledge-base articles in a consistent house style. And an online store will replace the background of product photos while keeping the product untouched.