Use these patterns when you need consistent brand assets or precise image edits. They adapt the OpenAI Cookbook guidance on high-fidelity edits and automation. Primary reference: Generate images with high input fidelity.
Preserve detail with input_fidelity="high"
When to enable
- Logo or product color tweaks that must preserve surrounding detail.
- Portrait adjustments where faces need to stay recognizable.
- Localized edits (add/remove props) without altering the background.
Automate asset pipelines
Workflow tips
- Store source images in Heroku Data for Redis or S3; pull by URL and feed to the edit endpoint.
- Run edits in a worker dyno and push results to a CDN (CloudFront/Fastly) via background jobs.
- Track prompt + output pairs in Postgres so designers can revert or reapply edits.
The cookbook suggests batching edits (resize, add/remove elements, face preservation) with helper functions and Pillow for preview generation.[^fidelity]
Wrap S3 uploads in retry logic (Heroku recommends
tenacity or AWS exponential backoff) and emit metrics when edits fail.Team workflow
Governance
- Restrict edit prompts to pre-approved templates (color swaps, copy updates) to avoid off-brand outputs.
- Attach a simple React admin UI (served from Heroku) to preview before publishing.
- Emit provenance metadata (prompt, date, operator) with each asset to satisfy audit requests.