gpt-image-2-generate

gpt-image-2 图像生成:使用 Azure OpenAI 的 gpt-image-2 生成光栅图像并保存为文件,适用于生成 PNG/JPEG/WebP、提示词优化及质量/尺寸/背景控制的工作流。

安装方式

先用 Prompt 核对来源与依赖。也可下载安装包。

用 AI 助手安装

复制提示词,让助手先核对固定版本和依赖。

查看 Prompt收起 Prompt
先检查当前 Agent 是否已安装 SkillPI Skill Finder。如果尚未安装,请按官方仓库的说明安装并启用:https://github.com/Findskills/skillpi。然后使用 Skill Finder 打开此 SkillPI 详情页并定位 "gpt-image-2-generate":https://skillpi.com/zh/skills/deepskill-796b2079cbadf893e222e92d9eb007f71be939e2dfb810c0c6995f086e997143。安装前核对上游来源和版本:https://skillhub.cn/skills/user_4741b2a8/gpt-image-2-generate。来源不一致时停止并说明差异。核对通过后,用 Skill Finder 安装目标 Skill,并报告安装路径和来源版本。

来源与配置

skillhub.cn

配置方式待核实

请查看原始来源中的适用工具、依赖和权限要求。

安装实测待补充

gpt-image-2 图像生成:使用 Azure OpenAI 的 gpt-image-2 生成光栅图像并保存为文件,适用于生成 PNG/JPEG/WebP、提示词优化及质量/尺寸/背景控制的工作流。

0 下载

介绍来源: third_party · user_4741b2a8 · 1.0.0 参考来源

SkillPi 解读

能完成的任务
翻译待完成,请参阅来源文档。
输入和输出
翻译待完成,请参阅来源文档。
软件、账号及付费要求
翻译待完成,请参阅来源文档。
实测状态
未测试

文件浏览

在原站浏览文件 ↗

原始 SKILL.md

打开原文 ↗
Frontmatter
name: gpt-image-2-generator
description: Generate raster images with Azure OpenAI gpt-image-2 and save them as files. Use this skill whenever the user asks to create, generate, draw, render, or make an image with gpt-image-2, GPT Image 2, Azure OpenAI image generation, or an OpenAI image generation model; also use it when they need saved PNG/JPEG/WebP image assets, prompt shaping for image generation, quality/size/background controls, or a reusable Azure-only CLI workflow for gpt-image-2.
compatibility: Python 3.9+, network access, AZURE_OPENAI_API_KEY

GPT Image 2 Generator

Use this skill to generate new bitmap images with Azure OpenAI's gpt-image-2 deployment and save the results into the user's workspace.

What This Skill Does

  • Turns a user's image idea into a production-oriented prompt for gpt-image-2.
  • Calls the bundled Azure-only script at scripts/gpt_image_2_generate.py.
  • Saves generated images as PNG, JPEG, or WebP files.
  • Uses AZURE_OPENAI_API_KEY from the environment by default.
  • Sends requests to the cached Azure gpt-image-2 endpoint unless AZURE_OPENAI_IMAGE_ENDPOINT or --endpoint is provided.
  • Supports quality, size, background, output format, output compression, and multiple outputs.

If the user wants to edit an existing image rather than generate a new one, explain that this skill currently ships a generation script. You can still use the prompt guidance here, then implement or call an edit workflow separately if the environment provides one.

Requirements

Before calling the script, check:

  1. AZURE_OPENAI_API_KEY is set in the shell environment.
  2. Network access is available.
  3. The output path is inside a writable workspace.

If the key is missing, do not invent a workaround. Ask the user to provide or configure AZURE_OPENAI_API_KEY.

The default Azure endpoint is:

https://admin-mgoh5ri9-eastus2.cognitiveservices.azure.com/openai/deployments/gpt-image-2/images/generations?api-version=2024-02-01

Use AZURE_OPENAI_IMAGE_ENDPOINT or --endpoint <full-url> only for another Azure OpenAI images/generations deployment URL.

Workflow

  1. Decide the output intent:
    • preview: a quick image for the conversation.
    • project asset: an image that should be saved under the current project or workspace.
    • deliverable: a named final file such as a cover, poster, product visual, or illustration.
  2. Collect or infer the key image requirements:
    • subject
    • style
    • aspect ratio or exact size
    • output format
    • quality
    • any text that must appear in the image, written exactly
    • anything to avoid
  3. Shape the prompt into a concise visual spec. Preserve the user's creative direction; add only practical details that make the output more controllable.
  4. Run a dry run first if you are unsure about parameters:
    python scripts/gpt_image_2_generate.py \
      --prompt "A quiet alpine lake at sunrise, cinematic natural light" \
      --out ./image.png \
      --size auto \
      --quality medium \
      --dry-run
  5. Generate the image:
    python scripts/gpt_image_2_generate.py \
      --prompt "A quiet alpine lake at sunrise, cinematic natural light" \
      --out ./image.png \
      --size auto \
      --quality medium
  6. Inspect the saved image before finishing when possible.
  7. Report the saved file path and the final prompt used.

Prompt Shape

Use this structure when the user gives a vague prompt:

Use case: <preview, illustration, product visual, poster, wallpaper, concept art, etc.>
Primary request: <the user's requested image>
Subject: <main subject and important attributes>
Composition: <framing, camera angle, crop, balance>
Style: <photorealistic, editorial, painterly, 3D, anime, watercolor, etc.>
Lighting and color: <time of day, contrast, palette>
Background/environment: <setting>
Text in image: <exact text, or "none">
Avoid: <watermarks, logos, extra text, distorted anatomy, unwanted objects>

Keep prompts direct. gpt-image-2 follows compact, explicit visual direction well; stuffing the prompt with unrelated adjectives usually makes the result less controllable.

Parameter Guidance

  • --quality: use medium by default. Use low for fast drafts and high for final images, text-heavy images, product visuals, or photorealistic work.
  • --size: use auto by default unless the user names an exact size or aspect. If unsure, choose an aspect that matches the use case:
    • square/avatar: 1024x1024
    • portrait/social story: 1024x1536
    • landscape/header: 1536x1024
    • flexible/current API best fit: auto
  • --output-format: use png unless the user asks for smaller files (jpeg/webp) or transparency (png/webp).
  • --background: use auto normally. Use transparent only for cutouts, stickers, icons, isolated objects, or compositing assets.
  • --n: use 1 unless the user asks for variants.
  • --endpoint: use only for a complete Azure OpenAI images/generations deployment URL.
  • --api-key-env: use only when the Azure key is intentionally stored in a non-default environment variable.

Text In Images

When the user wants text in the image:

  • Put the exact desired text in quotes.
  • Keep wording short.
  • Mention that no other text should appear.
  • Prefer --quality high for text-heavy images.

Example:

python scripts/gpt_image_2_generate.py \
  --prompt 'Minimal coffee poster with the exact headline "SLOW MORNING" and no other text, warm editorial product photography style' \
  --out ./slow-morning.png \
  --quality high

Transparent Outputs

For transparent cutouts:

python scripts/gpt_image_2_generate.py \
  --prompt "A single red enamel camping mug, isolated product cutout, no text, no shadow" \
  --out ./mug.png \
  --background transparent \
  --output-format png \
  --quality high

After generation, inspect the result because transparent outputs are only useful if the subject edges are clean and the asset contains no unintended backdrop.

Script Reference

The script uses the Azure OpenAI Images generation endpoint with this payload shape:

{
  "prompt": "...",
  "size": "auto",
  "quality": "medium",
  "n": 1
}

Requests are sent to the Azure deployment URL and authenticated with the api-key header. The payload omits the model field because the deployment is encoded in the endpoint URL.

The script accepts base64 image responses and writes them to disk. Run:

python scripts/gpt_image_2_generate.py --help

Safety And Fit

Follow the user's applicable content constraints and local policy. Do not generate images that violate policy. Do not claim an image was generated by gpt-image-2 unless the Azure API call succeeded.

Useful Examples

Photorealistic scene:

python scripts/gpt_image_2_generate.py \
  --prompt "Photorealistic editorial image of a ceramic teapot on a walnut table beside a rainy window, soft morning light, shallow depth of field, no text" \
  --out ./teapot.png \
  --quality high \
  --size auto

Wallpaper:

python scripts/gpt_image_2_generate.py \
  --prompt "Wide digital painting wallpaper of a moonlit desert observatory, crisp stars, subtle teal and amber accents, calm cinematic atmosphere, no text" \
  --out ./observatory.webp \
  --output-format webp \
  --quality medium \
  --size 1536x1024

Variants:

python scripts/gpt_image_2_generate.py \
  --prompt "Three-quarter view concept art of a compact electric city bicycle, clean studio background, industrial design sketch render, no text" \
  --out ./city-bike.png \
  --n 3 \
  --quality medium

当前收录版本

1.0.0

核对来源版本 ↗

质量评测

满分100 · 来自 SkillPi LAB 实验室的评测报告。

场景价值85/100

亮点

  • 提供基于 Azure OpenAI gpt-image-2 的高质量图像生成能力,满足设计、内容创作等高频需求
  • 支持多种输出格式(PNG/JPEG/WebP)、质量控制、透明背景及多图生成,功能完整且实用
触发精准90/100

亮点

  • 触发词覆盖全面且边界清晰,准确匹配用户关于图像生成的多种表达方式
结构规范95/100

待提升项

  • description 内容重复 原报告严重程度:轻微

    顶层 frontmatter 和 skill_body 内部均包含完整 description,存在冗余

    改进建议:建议移除 skill_body 开头的重复 frontmatter,保持单一权威描述源

  • 缺少显式 When to Use 章节 原报告严重程度:轻微

    文档未设置独立 'When to Use' 章节,尽管 Workflow 已涵盖使用场景

    改进建议:可添加简短 'When to Use' 段落以提升可读性

亮点

  • 文档结构清晰,包含完整的工作流、参数指导和安全说明
  • 提供丰富的端到端示例和 dry-run 机制,便于用户理解和测试
执行可靠90/100

亮点

  • 脚本路径明确,参数校验完善,支持环境变量配置和自定义端点
  • 包含 API key 缺失处理逻辑和 dry-run 预检机制,执行可靠性高
证据可验 (前四项均值)90/100

取前四项原始分值的算术平均,四舍五入取整。可通过收录报告核对各项评分与说明,运行记录需单独查证。

正文静态检测

100 / 100 · skillpi-20261123-no-r3-v1

正文未命中当前规则。

分数仅反映正文中的规则命中,供使用前参考。附件与运行行为不在此评分范围内。

权限与使用前检查

根据当前主文档自动整理,命中内容可能是示例或防护说明;不是实际权限声明,也未覆盖附件、外部依赖或运行行为。

  • 账号、密钥或授权

    使用专用、最小权限账号,不把密钥粘贴到公开内容或命令日志;核对接收数据的服务与租户。

    主文档提及 · 第 105, 153 行
文档引用的域名或地址

这些地址可能用于文档链接或示例,不是已批准的联网清单。使用前核对实际目的地及发送的数据。

  • admin-mgoh5ri9-eastus2.cognitiveservices.azure.com

本站展示提示不会授予权限。涉及文件改动、密钥、外部发送或费用时,仍由你使用的工具按需确认。

安全评级与访问范围

safe · 静态证据核验,不代表运行安全保证。

翻译待完成,请参阅来源文档。

使用前请由宿主核对并授权实际文件读写、外部服务和联网目的地;本站的核验不会授予任何运行权限。