GPT-Image2 Prompt Template Structure: Complete JSON Specification Guide
A GPT-Image2 prompt template is a JSON-like hierarchical specification that organizes image generation parameters into optional top-level fields including style, structure, content, camera, scene, and category-specific blocks such as character, brand, or product.
The freestylefly/awesome-gpt-image-2 repository defines a standardized approach to structuring prompts for GPT-Image2. This system uses a self-documenting JSON architecture that separates visual requirements into logical, reusable components, enabling precise control over AI-generated imagery through modular template definitions.
Core Components of a GPT-Image2 Prompt Template
According to the source code in docs/templates.md, a GPT-Image2 prompt template consists of up to eleven top-level keys that describe distinct aspects of the desired output. Each field is optional and populated only when the template's category requires it.
The complete field hierarchy includes:
style– Defines color schemes, lighting moods, artistic textures, and overall visual atmospherestructure– Describes layout primitives including UI components, infographic modules, typography grids, or poster sectionscontent– Contains placeholders for textual elements such as titles, subtitles, data points, or body copycamera– Specifies photographic parameters including lens type, focal length, aperture, and lighting directionsscene– Outlines the main subject, background elements, props, and atmospheric effects like fog or glowcharacter– Captures character-specific attributes including pose, expression, and costume detailsbrand– Includes brand identity specifications for logo-oriented generation tasksproduct– Provides product-specific descriptors for e-commerce and catalog imageryquality_constraints– Enforces technical limits on resolution, aspect ratio, and prohibited elements (negative prompts)output_requirements– Dictates final formatting rules such as JSON output, caption annotations, or file specifications
Template Categories and Conditional Fields
Templates are organized by category (UI, infographic, poster, product, brand, architecture, photo, illustration, character, scene, history, document, or other). The agents/skills/gpt-image-2-style-library/references/style-library.md file maps each category to its required template blocks using anchor tags like #tpl-ui and #tpl-poster.
A UI template might heavily populate structure and content while omitting character and camera. Conversely, a photography template would prioritize camera and scene while leaving brand and product empty.
Real-World Template Examples
The repository provides concrete JSON implementations demonstrating how these fields combine in practice.
UI Design Template
This excerpt from docs/templates.md demonstrates a minimal UI generation template:
{
"style": {
"palette": "cool-blue",
"texture": "smooth-glass"
},
"structure": {
"header": {"title": "{title}", "icon": "app"},
"sidebar": {"items": ["{item1}", "{item2}", "{item3}"]},
"content": {"cards": [{"title": "{cardTitle}", "description": "{cardDesc}"}]}
},
"camera": {
"lens": "50mm",
"lighting": "soft-front"
},
"quality_constraints": {
"aspect_ratio": "16:9",
"max_resolution": "4k"
}
}
Marketing Poster Template
For promotional materials, the template emphasizes dramatic styling and output specifications:
{
"style": {"mood": "dramatic", "colour": "high-contrast"},
"structure": {"headline": "{headline}", "subhead": "{subhead}", "visual": "{visual_desc}"},
"scene": {"subject": "{subject}", "background": "{bg_desc}"},
"output_requirements": {"format": "png", "size": "1200x1800"}
}
Template Processing Workflow
As documented in agents/skills/gpt-image-2-style-library/SKILL.md, the template system operates through a three-stage pipeline:
- Selection – The agent identifies the appropriate template category based on user intent
- Hydration – Placeholder braces (e.g.,
{title},{subject},{cardDesc}) are substituted with concrete values provided by the user - Assembly – The populated JSON structure is converted into the final prompt payload sent to the GPT-Image2 API
This workflow ensures that self-documenting templates remain reusable across different projects while maintaining strict type safety for image generation parameters.
Source Code Reference
The implementation spans four primary files within the repository:
| File Path | Description |
|---|---|
docs/templates.md |
Comprehensive collection of all template categories with full JSON examples and field definitions (lines 27–28, 110–114, 363–370, and throughout) |
agents/skills/gpt-image-2-style-library/references/style-library.md |
Category index linking template types (#tpl-ui, #tpl-poster, etc.) to their source definitions |
agents/skills/gpt-image-2-style-library/SKILL.md |
Agent workflow documentation explaining template selection, placeholder replacement, and prompt assembly |
README.md |
High-level overview of template categories with quick navigation links to specific sections |
Summary
- GPT-Image2 prompt templates use a JSON-like structure with eleven optional top-level fields organizing visual, technical, and content requirements
- Category-driven field selection determines which blocks (UI, character, camera, etc.) are included in a specific template
- Placeholder substitution uses brace notation (
{variable}) to convert static templates into dynamic prompts - Source documentation resides primarily in
docs/templates.mdwith agent logic implemented in thegpt-image-2-style-libraryskill directory - Self-documenting design ensures templates remain readable and maintainable without external documentation
Frequently Asked Questions
What are the required fields in a GPT-Image2 prompt template?
No fields are strictly required. The template structure is flexible by design, with each of the eleven top-level keys (style, structure, content, camera, scene, character, brand, product, quality_constraints, output_requirements) included only when relevant to the specific category. A minimal template might contain only a style block, while complex UI templates utilize multiple sections.
How do I choose the right template category for my image generation?
Select the category that best matches your output domain. The style-library.md reference file defines thirteen categories: UI, infographic, poster, product, brand, architecture, photo, illustration, character, scene, history, document, and other. Each category maps to specific template blocks—for example, choose "product" for e-commerce imagery requiring the product field, or "photo" for realistic photography needing detailed camera specifications.
What is the difference between "style" and "structure" in GPT-Image2 templates?
Style defines the aesthetic qualities of the image—color palettes, lighting moods, textures, and artistic techniques. Structure defines the spatial organization and component layout—where elements appear, their hierarchy, and their geometric relationships. For instance, a style might specify "neon cyberpunk aesthetic" while the structure defines "header at top, sidebar on left, content grid in center."
Where can I find the complete template reference documentation?
The definitive reference is located at docs/templates.md in the repository root, which contains exhaustive JSON examples for all thirteen categories. For implementation details on how agents process these templates, consult agents/skills/gpt-image-2-style-library/SKILL.md. The README.md provides a navigational overview with quick links to specific template sections.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →