Codex imagegen

From Takazudo/claude-resources · View interactive version

Codex imagegen is an AI agent skill from the GitHub repository Takazudo/claude-resources. Generate or redesign raster images (mockups, illustrations, photos, UI polish) via Codex CLI's $imagegen. Use whenever the user wants an image or PNG made, even without mentioning Codex.

How to use this skill

Skill file

codex-imagegen

Anthropic models are vision-in / text-out — they cannot emit raster pixels. This skill produces real PNGs by delegating to Codex CLI's $imagegen (the gpt-image-2 model behind ChatGPT Images), and keeps it on ChatGPT-included usage by stripping OPENAI_API_KEY from the call so it never silently bills the OpenAI image API.

Use the script

scripts/codex-imagegen.sh runs the whole flow (ChatGPT-auth preflight → concurrency-guarded headless codex exec → save to disk → optional exact resize) and prints the saved path:

"$HOME/.claude/skills/codex-imagegen/scripts/codex-imagegen.sh" \
  --prompt "<what to make>" [--out <name.png>] [--in <image>]... [--size WxH]

The script prints the absolute saved path. After it succeeds, Read that PNG to view/verify it and show the user.

Generate from scratch

scripts/codex-imagegen.sh --size 600x600 \
  --prompt "a realistic photo of a grey heron at the water's edge"

Redesign / polish from a screenshot

Pass the screenshot with --in. This is the design-polish path: the model works from the picture, not the app's source code.

scripts/codex-imagegen.sh --out redesign.png --in baseline.png \
  --prompt "redesign this pricing table to look premium — keep every number, column, and row identical; improve only spacing, typography, color, and dividers"

Output location

The script saves into the repo-scoped, Dropbox-synced cclogs dir — <cclogs-base>/<repo>/imagegen/ — resolved automatically by $HOME/.claude/scripts/get-logdir.js (the same {logdir} rule the other skills use; worktree-aware, _misc/ when outside a git repo). Don't hand-build the path: pass just a filename to --out, or omit it. An absolute --out overrides this when a specific destination is needed.

get-logdir detects the repo with git rev-parse from the current directory, so invoking the script from a non-repo cwd (a /tmp scratchpad, a Dropbox prototype dir) silently routes output to <cclogs>/_misc/imagegen/ instead of the repo. Pass --project-dir <repo-dir> to anchor resolution to the repo regardless of where the command runs — e.g. a design-polish loop that screenshots into /tmp should pass --project-dir "$REPO_ROOT" so mockups still land in <cclogs>/<repo>/imagegen/.

Cost — this burns ChatGPT plan usage fast

Each image costs roughly 90k–100k tokens of ChatGPT/Codex usage (image turns run ~3–5× heavier than text). Fine for a handful of design explorations; don't loop it dozens of times without telling the user. The script reports the tokens used per call.

Requirements & caveats

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.