agentsclimarketplace

Gpt image

Skill huqianghui/csa-ppt-plugin/skills/gpt-image

AI image generation skill using Azure OpenAI GPT-image-2 model. Generates photorealistic illustrations, conceptual visuals, scene imagery, hero backgrounds, and custom icons for presentations. Use this skill when slides need visual storytelling beyond structural diagrams — cover art, industry scenario photos, abstract concept illustrations, product UI mockups, or decorative backgrounds. Complements azure-diagrams (architecture) and excalidraw-diagram (hand-drawn) by providing the "visual expression layer" that programmatic tools cannot produce. Supports Chinese/English/Japanese/Korean text rendering in images. Output: PNG files ready for embedding into slides via the pptx skill.From its SKILL.md

Install
npx -y skills add huqianghui/csa-ppt-plugin --skill gpt-image

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

2 things to look at

  • no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
  • 2 stars2 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

What its file declares

Copied from the file, not written here

The file declares its own license as MIT. That is the author’s claim about this one file, and it is not the same thing as the license GitHub reports for the repository, which is listed with the other numbers below.

SKILL.md

11.8 KB, as published. Nobody here has run it

GPT-Image Generation Skill

Generate photorealistic and artistic images using Azure OpenAI GPT-image-2 for presentations.

When to Use This Skill

Use CaseExampleWhy GPT-image-2
Cover / Title slides"AI赋能数字化转型" concept artNo existing tool can create photorealistic concept illustrations
Industry scenario imageryRetail store, factory floor, hospital, smart cityScene-based visuals for solution demos
Abstract concept visuals"Zero Trust Security" metaphor, "Cloud Native" illustrationVisual storytelling beyond boxes and arrows
Product UI mockupsDashboard preview, mobile app conceptMore realistic than excalidraw hand-drawn
Hero backgroundsGradient mesh with tech elements for slide backgroundsCSS gradients are flat; AI creates depth
Custom icons / logosBranded concept icons not in Azure icon libraryFills gaps in standard icon sets
Multilingual infographicsImages with embedded Chinese/English textNative CJK text rendering support

When NOT to Use This Skill

ScenarioUse Instead
Cloud architecture diagrams (Azure/AWS/GCP)azure-diagrams — has 700+ official icons
Hand-drawn / whiteboard style sketchesexcalidraw-diagram — purpose-built for that aesthetic
Data charts (bar, pie, line)pptx built-in PptxGenJS charts
Simple icons and gradient barsSVG + Sharp rasterization

Execution Method

Always execute inline — do not create separate .py files:

python3 << 'EOF'
import os, base64, requests

endpoint = os.environ["AZURE_OPENAI_ENDPOINT"]
api_key = os.environ["AZURE_OPENAI_API_KEY"]
deployment = os.environ.get("GPT_IMAGE_DEPLOYMENT", "gpt-image-2")
api_version = "2025-04-01-preview"

url = f"{endpoint}openai/deployments/{deployment}/images/generations?api-version={api_version}"

response = requests.post(url, headers={
    "Api-Key": api_key,
    "Content-Type": "application/json"
}, json={
    "prompt": "YOUR PROMPT HERE",
    "n": 1,
    "size": "1536x1024",
    "quality": "high",
    "output_format": "png"
}).json()

if "error" in response:
    print(f"ERROR: {response['error']}")
else:
    img_data = base64.b64decode(response["data"][0]["b64_json"])
    output_path = "outputs/{project}/diagrams/image-name.png"
    os.makedirs(os.path.dirname(output_path), exist_ok=True)
    with open(output_path, "wb") as f:
        f.write(img_data)
    print(f"Image saved: {output_path} ({len(img_data)} bytes)")

EOF

Prerequisites

Configuration (Required)

推荐方式:编辑 config.json(在 skill 根目录 gpt-image/config.json):

{
  "azure_openai_endpoint": "https://your-resource.openai.azure.com/",
  "azure_openai_api_key": "your-api-key",
  "deployment_name": "gpt-image-2",
  "api_version": "2025-04-01-preview"
}

配置优先级:CLI 参数 > config.json > 环境变量

备选方式:环境变量(如果 config.json 未填写,会自动回退到环境变量):

export AZURE_OPENAI_ENDPOINT="https://your-resource.openai.azure.com/"
export AZURE_OPENAI_API_KEY="your-key"
export GPT_IMAGE_DEPLOYMENT="gpt-image-2"

Python Dependencies

pip install requests pillow

Verify Setup

# 查看当前配置来源
python3 scripts/generate_image.py config

# 完整验证(含 API 连通性测试)
python3 scripts/generate_image.py verify

API Parameters

ParameterValuesDefaultNotes
sizeSee size table below1024x1024Both edges must be multiples of 16
qualitylow, medium, highhighlow = fast/cheap, high = best quality
n1-101Number of images per request
output_formatpng, jpeg, webppngUse png for transparency support
backgroundauto, transparentautoRequires png format
output_compression0-100—JPEG only

Recommended Sizes for PPT

Use CaseSizeAspect RatioNotes
Full-width slide image1536x10243:2Fits 16:9 slide well
Right-panel diagram1024x10241:1For 左文右图 layout
Wide banner / hero1920x108016:9Full slide background
Tall sidebar1024x15362:3Vertical illustration
4K high-res3840x216016:9For print or zoom

GPT-image-2 supports arbitrary resolutions: both edges must be multiples of 16px, long edge up to 3840px, pixel count 655,360–8,294,400.

Prompt Engineering for PPT Images

Core Principles

  1. Describe the visual scene, not the concept — "A modern glass-walled data center with blue LED server racks and holographic dashboards floating in the air" is better than "cloud computing"
  2. Specify the style — "corporate illustration style", "isometric 3D", "flat design with subtle gradients", "photorealistic"
  3. Include composition guidance — "wide angle", "bird's eye view", "centered subject with blurred background"
  4. Match the PPT color palette — mention colors explicitly: "predominantly white and light gray background with orange (#E8913A) accent elements"
  5. Request clean backgrounds — for slide embedding: "clean white background" or "transparent background"

Prompt Templates by Use Case

Cover / Title Slide Art

A [style] illustration of [concept], featuring [specific visual elements].
The scene uses a clean, modern aesthetic with a predominantly white/light
background. Key accent colors: warm orange and cool blue tones.
Corporate presentation quality, high detail, professional.

Industry Scenario

A photorealistic view of [industry setting], showing [specific activity].
Modern, well-lit environment. Shot from [angle]. Professional quality,
suitable for a business presentation. No text overlays.

Abstract Concept

An abstract [style] visualization representing [concept]. Use geometric
shapes, flowing lines, and a color palette of [colors]. Minimalist
composition with strong visual hierarchy. Clean background suitable
for slide overlay text.

Background / Hero Image

A subtle, abstract background pattern for a presentation slide.
Soft gradients blending [color1] to [color2] with [geometric/organic]
elements. Low contrast, suitable for overlaying dark text. Resolution:
1920x1080, corporate and modern feel.

Text in Images (Multilingual)

GPT-image-2 supports rendering text in Chinese, English, Japanese, Korean, Hindi, Bengali:

Create an infographic with the title "数字化转型路线图" in bold Chinese text
at the top. Below it, show 4 stages with labels in Chinese...

Tip: Keep embedded text short and large. Complex multi-paragraph text may render poorly.

Integration with CSA-PPT Workflow

File Output Convention

All generated images go to {workspace_path}/diagrams/ with descriptive names:

outputs/{project}/diagrams/
├── cover-concept.png          ← Title slide illustration
├── retail-scenario.png        ← Industry scenario image
├── zero-trust-visual.png      ← Abstract concept art
├── hero-background.png        ← Slide background
└── manifest.md                ← Updated with new entries

Manifest Entry Format

When adding to diagrams/manifest.md:

| cover-concept.png | Concept Art | gpt-image-2 | 1536x1024 | AI digital transformation concept for title slide |

Quality Verification

After generating each image:

  1. Check file exists and is non-empty: ls -la {path}
  2. Verify dimensions: python3 -c "from PIL import Image; img=Image.open('{path}'); print(img.size)"
  3. Visual check: Use the Read tool to view the image (Claude Code supports image viewing)

Retry Strategy

If generation fails:

  1. content_policy_violation: Rephrase the prompt to be less specific about people/faces
  2. Rate limit (429): Wait 10 seconds, retry with quality="medium"
  3. Timeout: Retry with smaller size or quality="low"
  4. Persistent failure: Log to progress.md as [ERROR], suggest using SVG+Sharp as fallback for simple visuals

Image Editing (Advanced)

GPT-image-2 also supports editing existing images (inpainting):

python3 << 'EOF'
import os, base64, requests

endpoint = os.environ["AZURE_OPENAI_ENDPOINT"]
api_key = os.environ["AZURE_OPENAI_API_KEY"]
deployment = os.environ.get("GPT_IMAGE_DEPLOYMENT", "gpt-image-2")
api_version = "2025-04-01-preview"

url = f"{endpoint}openai/deployments/{deployment}/images/edits?api-version={api_version}"

with open("source_image.png", "rb") as img_file:
    response = requests.post(url,
        headers={"Api-Key": api_key},
        data={
            "prompt": "Replace the background with a modern office setting",
            "n": 1,
            "size": "1024x1024",
            "quality": "high"
        },
        files={
            "image": ("source.png", img_file, "image/png"),
            # Optional mask for targeted editing:
            # "mask": ("mask.png", open("mask.png", "rb"), "image/png"),
        }
    ).json()

if "error" in response:
    print(f"ERROR: {response['error']}")
else:
    img_data = base64.b64decode(response["data"][0]["b64_json"])
    with open("edited_image.png", "wb") as f:
        f.write(img_data)
    print("Edited image saved")

EOF

Use cases for editing:

  • Background replacement: Generate a concept image, then replace its background to match slide theme
  • Style transfer: Edit an existing diagram to add artistic elements
  • Localization: Replace English text in an image with Chinese text

Error Handling

ErrorCauseResolution
DeploymentNotFoundWrong deployment nameCheck GPT_IMAGE_DEPLOYMENT env var
401 UnauthorizedInvalid API keyVerify AZURE_OPENAI_API_KEY
429 Too Many RequestsRate limitWait + retry with lower quality
content_policy_violationPrompt blocked by content filterRephrase prompt, avoid specific faces/people
InvalidPayloadBad parametersCheck size is multiple of 16, valid format

Guidelines

  • Always use quality="high" for final presentation images. Use "medium" only for drafts/iteration.
  • Prefer 1536x1024 as the default size for most PPT use cases (good balance of quality and speed).
  • Transparent backgrounds (background="transparent") are useful for overlaying on colored slide backgrounds.
  • Keep prompts detailed — vague prompts produce generic results. Include style, composition, colors, mood.
  • Match the PPT color palette — reference the CLAUDE.md color scheme (orange #E8913A, blue #4472C4, etc.) in prompts.
  • No text-heavy images — GPT-image-2 handles short labels well but struggles with paragraphs. Use slide text overlays instead.
  • One image per prompt — generate n=1 for quality control. Batch generation (n>1) gives varied results.

Keep looking

Skills are one crate of 609,689. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.