mishagavura/claude-code-image-generation / skills/codex-image
codex-image
VerifiedGenerate or edit raster images (photos, illustrations, mockups, hero images, product shots, bitmap icons, transparent cutouts) with OpenAI GPT Image 2 by triggering the local Codex CLI, billed to the user's ChatGPT subscription — no API key needed. Use when the user says "generate an image", "make a picture/illustration/mockup", "use codex / gpt image / gpt-image-2", "edit this image", "remove the background", or a project needs a bitmap asset. Not for video, SVG, or graphics better built in code.
SKILL.md
View on GitHub---
name: codex-image
description: Generate or edit raster images (photos, illustrations, mockups, hero images, product shots, bitmap icons, transparent cutouts) with OpenAI GPT Image 2 by triggering the local Codex CLI, billed to the user's ChatGPT subscription — no API key needed. Use when the user says "generate an image", "make a picture/illustration/mockup", "use codex / gpt image / gpt-image-2", "edit this image", "remove the background", or a project needs a bitmap asset. Not for video, SVG, or graphics better built in code.
---
# codex-image
Runs Codex CLI non-interactively. Codex calls its built-in `image_gen` tool (GPT Image 2) and the
script copies the result to the path you choose. Each call takes roughly 30–90 seconds.
The script is `gen.sh` in this skill's base directory (shown when the skill loads), referred to below as `<skill-dir>`.
## Command
```bash
<skill-dir>/gen.sh -o <out.png> [options] "<prompt>"
```
| Option | Meaning |
|---|---|
| `-o PATH` | Output file (required). Put project assets inside the project; otherwise use a temp/scratch folder. |
| `-n N` | 1–4 variants → `out-1.png`, `out-2.png`, … |
| `-r FILE` | Reference image for style/composition (repeatable) |
| `-e FILE` | Image to edit — only what the prompt asks changes |
| `-t` | Transparent background |
| `-a square\|portrait\|landscape` | Aspect ratio |
Prints the saved absolute path(s). Never overwrites: an existing name gets a time suffix.
Give the Bash call a timeout of at least 300000 ms (600000 for `-n 3` or `-n 4`). For several different
images, run separate commands in parallel instead of describing them all in one prompt — parallel runs are safe.
## Workflow
1. Turn the request into a clear prompt: subject, style/medium, composition, lighting, palette,
exact text in quotes, and what to avoid. Keep the user's specifics; add detail only when the ask is vague.
2. Run `gen.sh`.
3. **Look at the output image** and check it matches (subject, spelling of any text, framing). If it's off,
rerun with one targeted prompt change, or use `-e` on the result for a small fix.
4. Report the saved path(s) and the final prompt. If the image is for a project, reference it from the code.
## Troubleshooting
- `codex CLI not found` → the user needs `npm i -g @openai/codex`.
- `Codex is not logged in` → the user runs `codex login` and signs in with ChatGPT.
- `No image was generated` → the ChatGPT plan's image limit may be used up, or the prompt was refused.
Say so; don't retry in a loop.
- `-t` output can have semi-transparent blotches. Check it; if dirty, regenerate on a plain white background
without `-t` and remove the background separately.
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis. | Stars: 471k | Updated | Claude CodeCodex | Verified | Install |
| diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness. | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependencies | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |