# Gpt Image Generation

> Self-contained GPT image generation skill for creating PNG images through the ChatGPT Codex backend with prompt-file input and a minimal local Node CLI. Use when Codex needs to generate a new image from a text prompt, read a prompt verbatim from a local file, choose a backend-supported output size and quality, or save generated images to disk.

- Skill: `xue-xiaobao/gpt-image-generation` (Agent Skill, multi-file: 6 files)
- Install (CLI): `npx skillmds@latest add xue-xiaobao/gpt-image-generation`
- Raw SKILL.md: https://api.skillmd.com/api/skills/xue-xiaobao/gpt-image-generation/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: AI & ML
- Author: xue-xiaobao (https://skillmd.com/u/xue-xiaobao)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/xue-xiaobao/gpt-image-generation

---


# GPT Image Generation

Run the bundled Node CLI from this skill directory.

## Workflow

1. Work from the skill root that contains this `SKILL.md`.
2. Ensure `codex login` has created `~/.codex/auth.json`.
3. Generate images with:

```bash
node ./scripts/cli.js \
  --prompt-file ./prompt.md \
  --size 1024x1024 \
  --quality high \
  --output ./outputs/storyboard.png
```

4. Use `--prompt` for inline text or `--prompt-file` to read the prompt verbatim from disk.
5. Treat `--size` as a request to the current backend, not a guaranteed capability. Do not claim 4K support; use `1024x1024` as the safe default unless the backend confirms another size.
6. Report the absolute output path after generation.

## Notes

- Keep the prompt text unchanged when the user provides a finished prompt file.
- The runtime entrypoint is `scripts/cli.js`; supporting validation tests live in `scripts/test.js`.
- The CLI reads the local Codex login from `~/.codex/auth.json`.
- The CLI does not hardcode or derive any OAuth client identity; if the local `access_token` is near expiry, rerun `codex login` before generation.
- The CLI writes PNG files and prints the backend-reported size when available.
- If the backend rejects a requested size, retry with `1024x1024` instead of presenting the requested size as supported.

