How to Use GPT-Image2 Prompt Templates: A Complete Guide to Structured Image Generation

GPT-Image2 prompt templates transform free-form natural language into structured, reproducible specifications using plain-text or JSON formats from the freestylefly/awesome-gpt-image-2 repository.

The freestylefly/awesome-gpt-image-2 repository provides an industrial-grade library of prompt templates that standardize visual generation workflows. These templates eliminate ambiguity by enforcing a consistent schema across eight visual categories, enabling both manual copy-paste workflows and programmatic automation through the bundled Agent skill.

Template Architecture and Schema

The repository stores templates in two interchangeable forms within docs/templates.md. The plain-text template provides human-readable, copy-and-paste ready prompts for ad-hoc generation, while the JSON template offers machine-readable structures ideal for agents and automation scripts.

All templates follow a unified schema containing six core fields:

  • type – Visual category (UI Screenshot, Infographic, Poster, etc.)
  • platform – Target platform (iOS, Android, Web, etc.)
  • product – Product name or identifier
  • layout – Structural composition (card-based feed, top navigation, etc.)
  • style – Visual attributes including theme, primary colors, and typography
  • constraints – Output specifications (aspect ratio, fidelity, text legibility)

Templates use bracketed placeholders such as [产品类型], [平台], and [颜色] that you replace with specific values to create complete prompts.

Step-by-Step Implementation Workflow

Following the architectural flow defined in the repository ensures consistent results whether generating images manually or programmatically.

Browse docs/gallery.md to identify reference cases matching your desired aesthetic. Each case demonstrates a completed output from a specific template category.

2. Select a Template Category

The repository organizes templates into eight categories (UI, Infographic, Poster, and others) that map directly to sections in docs/templates.md. Select the category matching your use case.

3. Copy the Template Structure

Extract either the plain-text block or the JSON block from the selected category section. Both formats contain identical structural information.

4. Fill Placeholder Variables

Replace bracketed placeholders with your specific parameters. For example, transform the generic UI template:

为[产品类型]生成一张[平台]界面图。
核心功能:[功能点A]、[功能点B]、[功能点C]。
视觉风格:[极简/科技/拟物],主色[颜色],强调色[颜色]。
布局:[顶部导航/双栏/卡片流],信息层级清晰,留白充足。
输出:高保真UI截图,文字清晰可读,比例[9:16/16:9]。

Into a concrete specification:

为Fitness App生成一张iOS界面图。
核心功能:卡片式活动展示、实时心率监控。
视觉风格:极简/科技,主色Neon Green,强调色Black。
布局:顶部导航 + 卡片流,信息层级清晰,留白充足。
输出:高保真UI截图,文字可读,比例9:16。

5. Generate the Image

Manual Generation: Paste the completed prompt into the live demo site at gpt-image2.canghe.ai after authenticating via Supabase Auth.

Programmatic Generation: Pass the JSON payload to the gpt-image-2-style-library skill located in agents/skills/gpt-image-2-style-library/SKILL.md, which forwards the request to the underlying GPT-Image2 API and returns the image URL.

Implementation Methods

Manual Plain-Text Workflow

For one-off generations, copy the plain-text template from docs/templates.md, substitute all bracketed variables with your content, and submit via the web interface. This method requires no tooling setup and provides immediate visual feedback.

Programmatic JSON Workflow

For automated pipelines, use the JSON template structure. The single source of truth resides in data/style-library.json, which the website, Agent skill, and CLI tools all consume to ensure consistency.

Execute generation via the bundled CLI:

npx gpt-image-2-style-library generate \
  --template ui \
  --vars type="UI Screenshot" platform="iOS" product="Fitness App" \
        layout="Card‑based feed with bottom tab bar" \
        style.theme="Dark Mode" style.primary_color="Neon Green"

The command returns a JSON object containing the image URL and metadata.

Agent Skill Integration

Invoke the skill programmatically from JavaScript environments such as Claude Code or Cursor:

import { gptImage2StyleLibrary } from 'gpt-image-2-style-library';

await gptImage2StyleLibrary.generate({
  template: 'ui',
  vars: {
    type: 'UI Screenshot',
    platform: 'iOS',
    product: 'Fitness App',
    layout: 'Card‑based feed with bottom tab bar',
    style: { theme: 'Dark Mode', primary_color: 'Neon Green' },
    content: {
      header: "Today's Activity",
      cards: [{ title: 'Running', data: '5.2 km', button: 'Start' }]
    },
    constraints: 'High fidelity, readable text, 9:16 aspect ratio'
  }
});

The promise resolves to an object containing the generated image URL.

Key Repository Files

Understanding the file structure enables advanced customization and debugging:

Summary

  • GPT-Image2 templates convert natural language into structured prompts using a six-field schema (type, platform, product, layout, style, constraints).
  • Two formats exist: Plain-text for manual use and JSON for programmatic automation via the gpt-image-2-style-library skill.
  • Placeholders such as [产品类型] and [平台] must be replaced with specific values before generation.
  • Generation options include the web interface at gpt-image2.canghe.ai or CLI/Agent automation using npx gpt-image-2-style-library.
  • Data consistency is guaranteed by data/style-library.json, which serves as the single source of truth for all repository tools.

Frequently Asked Questions

What is the difference between plain-text and JSON templates?

Plain-text templates provide human-readable, copy-and-paste ready content for manual submission to the GPT-Image2 interface. JSON templates offer machine-readable structures that enable programmatic validation, variable injection, and batch processing through the Agent skill. Both formats describe identical visual parameters but serve different workflow requirements.

How do I access the live demo site for manual generation?

Navigate to gpt-image2.canghe.ai and authenticate using Supabase Auth. Once logged in, paste your completed plain-text prompt—derived from the templates in docs/templates.md—into the input field to generate images immediately without requiring API integration.

Can I use these templates with Claude Code or Cursor?

Yes. The gpt-image-2-style-library skill located in agents/skills/gpt-image-2-style-library/SKILL.md is designed for agent integration. Import the skill into your Claude Code or Cursor environment, pass the JSON template structure with your specific variables, and the agent will handle API communication and return the generated image URL.

Where are the template definitions stored?

All template definitions reside in data/style-library.json, which acts as the single source of truth. The website frontend, CLI tools, and Agent skill all read from this file, ensuring that whether you use the web interface, the npx command, or JavaScript API calls, you are referencing identical prompt specifications.

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:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →