Image Generation

VerifiedCaution

Use gpt-image-2 through an OpenAI-compatible relay to generate or edit images, including transparent PNGs and arbitrary target sizes.

Sby Skills Guide Bot
ContentIntermediate
7/24/2026
Claude CodeCodex
#image-generation#image-editing#gpt-image-2#transparent-png#asset-resize

Recommended for

Automated summary

Generates and edits images with gpt-image-2 through an OpenAI-compatible relay, including local resizing and transparent PNG cutout.

Strengths

  • Handles both generation and editing from a source image, preferring edit mode when both an image and edit intent are present.
  • Maps unsupported target sizes to the closest supported generation size, then resizes locally with contain, cover, or stretch modes.
  • Produces transparent PNGs by generating on a flat #ff00ff chroma-key background and removing the key color locally.
  • Retries timeouts and transient failures such as HTTP 502/504 and RemoteDisconnected before returning an error.

Limitations

  • Requires a configured OpenAI-compatible relay, such as sub2api, along with the associated credentials.
  • Native transparency is not reliable through this chain; chroma-key removal may leave color fringes.
  • Only supports gpt-image-2 and the stable generation sizes 1024x1024, 1536x1024, 1024x1536, and auto.
When to use it

Use it when you need to create or retouch an image asset with gpt-image-2, especially for a specific target size or transparent background.

When not to use it

Avoid it when no OpenAI-compatible relay is configured, when the user wants a different image model, or when pixel-perfect transparency is essential.

Security analysis

Caution
Quality score90/100

The skill relies on Bash, Python, and network calls to generate/edit images through an API relay. It reads local credential files and sends prompts to a remote endpoint, but there is no evidence of destructive commands, credential exfiltration beyond the intended API, or obfuscated payloads. This is legitimate use of powerful tools.

Findings
  • •Uses Bash to execute a Python script that makes network requests to an external image generation API.
  • •Reads local credential/config files (~/.codex/auth.json, ~/.claude/settings.json) to determine API endpoint and authentication.
  • •Falls back to curl.exe with --ssl-no-revoke on Windows, which could be used for network requests.
How this analysis is made

Examples

Transparent Unity overlay
Generate a transparent 1920x1080 PNG of a stylized blue ocean wave for a Unity UI overlay, no text, using gpt-image-2, and save it to ./assets/ui.
Edit a product image
Edit this image: replace the background with pure white while keeping the product details, and output a PNG.
Vertical poster base
生成图片:赛博朋克城市夜景海报底图,竖版 1024x1536,高质量,保存为 PNG。

name: gen-images description: Use when the user asks to generate or edit images with gpt-image-2, including "生成图片", "文生图", "修改图片", "编辑图片", "改图", transparent PNG output, or arbitrary target UI asset sizes through an OpenAI-compatible relay such as sub2api. argument-hint: <natural language image request> allowed-tools: [Bash, Read]

gen-images

Use this skill to call gpt-image-2 through an OpenAI-compatible relay such as sub2api for image generation and image editing.

Task Types

Generate when the user asks for:

  • 生成图片
  • 文生图
  • 画一张图
  • 使用 gpt-image-2
  • a new PNG/JPG/WebP asset

Edit when the user provides an image source and asks to change it:

  • 修改图片
  • 编辑图片
  • 改图
  • 把这张图改成...

If both an image source and edit intent are present, prefer edit mode.

Required Fields

Generate:

  • prompt

Edit:

  • prompt
  • image

Ask a short follow-up only when a required field is missing.

Optional Fields

Extract these when present:

  • size
  • quality
  • background
  • output_format
  • n
  • moderation
  • output_compression
  • partial_images
  • input_fidelity for edit only
  • resize_mode
  • output_dir
  • output_name
  • request_timeout
  • mask

Do not repeatedly ask for optional fields. Use defaults when unspecified.

Size Rules

Official stable gpt-image-2 generation sizes are:

  • 1024x1024
  • 1536x1024
  • 1024x1536
  • auto

Behavior:

  • If the user does not specify size, do not pass a size. The API default is auto.
  • If the user specifies auto, pass auto.
  • If the user specifies a supported size, pass it directly.
  • If the user specifies an unsupported target size, choose the closest supported generation size, then locally resize the saved PNG to the target size.

Example:

--size 1920x1080

will generate with 1536x1024, then save a final 1920x1080 image.

Resize Modes

When local resize is needed:

  • contain default: preserve aspect ratio, no crop, transparent padding.
  • cover: preserve aspect ratio, fill target, crop overflow.
  • stretch: non-uniform scaling to exact target.

Use contain for Unity UI overlays, panels, icons, and transparent assets. Use cover for full-screen backgrounds. Use stretch only when the user explicitly accepts distortion.

Transparent PNG Rules

gpt-image-2 does not reliably support native background=transparent through this chain.

When the user asks for transparent output:

  1. Generate a PNG on a flat #ff00ff chroma-key background.
  2. Locally remove the key color.
  3. Save a true alpha PNG.

If the user does not ask for transparency, do not pass background; let the API default to auto.

Script

Use:

python "<skill-dir>/scripts/gen_images.py" --mode generate --prompt "..."

or:

python "<skill-dir>/scripts/gen_images.py" --mode edit --prompt "..." --image "..."

Prefer py when available; otherwise use python.

Common generation example:

python "<skill-dir>/scripts/gen_images.py" \
  --mode generate \
  --prompt "transparent blue ocean wave Unity UI overlay, no text" \
  --size 1920x1080 \
  --background transparent \
  --output-format png \
  --resize-mode contain \
  --output-dir "./assets/ui" \
  --request-timeout 900

Timeout Rules

Default request timeout is 600 seconds.

Use --request-timeout 900 or higher for large images, edit mode, transparent post-processing, or slow relays. Request timeout, HTTP 502/504, and RemoteDisconnected are treated as transient failures and retried before returning a JSON error.

Runtime Config

When installed under .codex, the script reads:

  • ~/.codex/config.toml
  • ~/.codex/auth.json

It uses the active model_provider from config.toml, then reads that provider's base_url. For Codex mode, set base_url so <base_url>/images/generations and <base_url>/images/edits are valid for the relay. If the relay expects standard /v1/images/... endpoints, include /v1 in base_url.

When installed under .claude, the script reads:

  • ~/.claude/settings.json

Output

Default output goes to the current working directory:

./gen-images/

If the user specifies a folder/path, pass --output-dir. When --output-dir is set and --output-name is omitted, the saved file name is derived from the prompt as a safe slug.

If the user specifies an exact name, pass --output-name. Extensions in --output-name are ignored; the final extension follows output_format or post-processing. Multiple images append -01, -02, etc. Existing files are not overwritten; a numeric suffix is added.

The script prints JSON:

{"ok": true, "paths": ["..."], "used_params": {"model": "gpt-image-2", "size": "1920x1080", "generation_size": "1536x1024", "resize_mode": "contain", "background": "transparent", "output_format": "png", "output_dir": "./assets/ui", "output_name": null, "request_timeout": 900, "n": 1}}

On failure:

{"ok": false, "error": "..."}

Notes

  • Do not include unsupported OpenAI API fields such as response_format or default stream in image generation requests.
  • Edit mode uses multipart upload with image[] and optional mask.
  • Windows TLS failures fall back to curl.exe --ssl-no-revoke.
  • Repeated request timed out, 502, or 504 errors usually indicate relay/upstream capacity or gateway timeout, not a local post-processing failure.

From the file to a first result

The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.

View the source and supporting files

This download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.

1. Download the file

Download SKILL.md

From the root of a test project, save the file as .skill-downloads/image-generation-mryiqg44/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.

Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.

mkdir -p '.skill-downloads/image-generation-mryiqg44' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/image-generation-mryiqg44/download' --output '.skill-downloads/image-generation-mryiqg44/SKILL.md.part' && mv '.skill-downloads/image-generation-mryiqg44/SKILL.md.part' '.skill-downloads/image-generation-mryiqg44/SKILL.md'

2. Check prerequisites

Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.

No recognized prerequisites section in this file. This does not mean it is self-contained: libraries, tools and access requirements may be mentioned elsewhere in the content or source repository.

The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.

3. Load the skill

After inspection, copy the complete folder into your project using one of the commands below, then open a new tool session. The command stops if a folder with the same name already exists: compare the files before replacing it.

Claude Code
test -f '.skill-downloads/image-generation-mryiqg44/SKILL.md' && test -s '.skill-downloads/image-generation-mryiqg44/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/gen-images' && cp -R '.skill-downloads/image-generation-mryiqg44' '.claude/skills/gen-images'

Codex
test -f '.skill-downloads/image-generation-mryiqg44/SKILL.md' && test -s '.skill-downloads/image-generation-mryiqg44/SKILL.md' && mkdir -p '.agents/skills' && test ! -e '.agents/skills/gen-images' && cp -R '.skill-downloads/image-generation-mryiqg44' '.agents/skills/gen-images'

OpenSkills

OpenSkills must already be installed. The local install/read procedure is checked with OpenSkills 1.5.0, which requires Node.js ≥ 20.6.0. Catalog slugs are not resolved automatically.

Official OpenSkills installation
openskills install './.skill-downloads/image-generation-mryiqg44'

openskills read 'image-generation-mryiqg44'

Reading should display the installed file content and its base directory. It does not run the skill or install its dependencies.

For an agent that reads AGENTS.md, then sync the index. This command changes AGENTS.md: review the diff before using it.

openskills sync

Manual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.

4. Try a first task

Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:

Read .skill-downloads/image-generation-mryiqg44/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.

Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.

Related skills