codex-imagegen
Generate or edit raster images (photos, illustrations, mockups, logos, product shots, game/UI assets, textures, infographics) using Codex's built-in image_gen tool — driven headlessly through `codex exec`. Billed via the user's ChatGPT/Codex login, so it needs NO OpenAI API key. Use whenever the user wants to create a brand-new image from a text prompt, edit an existing local image (background swap, lighting/weather change, object add/remove, restyle), or produce several image variants. Trigger on "generate an image", "make a picture/illustration/logo/mockup of X", "create a hero image", "edit this image", "change the background of X", "turn this photo into Y", "imagegen", "use codex to make an image". Do NOT use for vector/SVG icon systems, diagrams better built in code/HTML/CSS, or when the user explicitly wants the OpenAI Image API directly (that's the gpt-image CLI path).
What this skill does
# codex-imagegen
Generate and edit bitmap images from Claude Code by driving **Codex's built-in `image_gen` tool** through a one-shot `codex exec` run.
## Why this works (the mechanism)
Codex ships a `$imagegen` skill with two modes:
1. **Built-in `image_gen` tool (this skill uses it)** — runs against Codex's own backend using the user's **ChatGPT/Codex login** (`~/.codex/auth.json`). **No `OPENAI_API_KEY` required**, no per-image API billing. It's the default Codex mode.
2. CLI fallback (`scripts/image_gen.py`) — hits the OpenAI Image API directly, needs `OPENAI_API_KEY`. This skill does **not** use it.
The built-in tool is internal to Codex's agent runtime — there is no `codex image` subcommand. But a headless `codex exec "<prompt>"` run **can** invoke it. The wrapper script builds a tightly-scoped prompt that forces Codex to use only the built-in tool, runs `codex exec`, then locates the PNG Codex just wrote under `$CODEX_HOME/generated_images/` and copies it into the working directory with a clean filename.
Source it wraps: `~/.codex/skills/.system/imagegen/` (Codex's installed skill).
## Prerequisites
- `codex` CLI on PATH and **logged in** (`codex login`). Verify: `codex login status` or just run a generation — the wrapper reports a clear error if Codex isn't authed.
- No API key needed. The wrapper explicitly tells Codex *not* to use the API/CLI fallback.
## Usage
The wrapper lives at `scripts/codex_imagegen.py` (resolve its absolute path relative to this SKILL.md).
### Generate
```bash
python3 scripts/codex_imagegen.py generate \
--prompt "a minimal hero image of a ceramic coffee mug, soft studio lighting, lots of negative space" \
--out ./hero.png
```
- `--out` accepts a file (`./hero.png`), a directory (`./images/` → auto-named from the prompt), or is omitted (lands in cwd, named from a slug of the prompt).
- `-n 3` generates 3 **distinct** images (one built-in call each). With `-n>1` and a file `--out`, outputs are suffixed `-1`, `-2`, `-3`.
- Existing files are never overwritten unless `--force`; otherwise a `-v2` sibling is written.
### Edit an existing local image
```bash
python3 scripts/codex_imagegen.py edit \
--image ./photo.png \
--prompt "change the background to a warm sunset gradient; keep the subject unchanged" \
--out ./photo-sunset.png
```
The wrapper makes Codex load the local file with its built-in `view_image` tool first, then edit it. Default output (no `--out`) is `<name>-edited.png` in cwd.
### Output
On success the script prints `[codex-imagegen] wrote <path>` lines and then the absolute path(s) on their own line(s). Each run takes ~30–90s (it spins up a Codex agent). Report the final path(s) to the user and, when useful, Read the PNG to show it inline.
## Prompting guidance
The built-in tool renders well from a structured spec. Shape the user's request into: **scene/backdrop → subject → details → constraints**, plus intended use for the right polish level.
- Already-detailed prompt → normalize it, don't pad it.
- Generic prompt → add only tasteful, materially-helpful detail (composition, lighting, intended use). Don't invent extra subjects, brands, slogans, or palettes the user didn't imply.
- Quote exact in-image text verbatim and specify placement/typography.
- For **edits**, state invariants every time: "change only X; keep Y unchanged."
- For many *distinct* assets, issue separate generations — don't ask for one image "containing" all of them.
Use cases the built-in tool handles well: photorealistic scenes, product mockups, UI mockups, infographics, ads/marketing creatives, logos, illustrations, stylized concept art, and edits (object swap, lighting/weather, background replace, restyle, composite).
## Transparent backgrounds
The built-in tool has no native transparency control. For a transparent cutout of a *simple* opaque subject: generate it on a flat `#00ff00` chroma-key background (`#ff00ff` if the subject is green), then key it out locally with Codex's helper:
```bash
python3 "${CODEX_HOME:-$HOME/.codex}/skills/.system/imagegen/scripts/remove_chroma_key.py" \
--input <source.png> --out <final.png> \
--auto-key border --soft-matte --transparent-threshold 12 --opaque-threshold 220 --despill
```
Truly hard cases (hair, fur, glass, smoke, soft shadows) need real transparency, which only the OpenAI-API CLI fallback (`gpt-image-1.5 --background transparent`) provides — that requires `OPENAI_API_KEY` and is out of scope for this skill. Tell the user if a request needs it.
## When NOT to use
- Vector/SVG icon or logo *systems* already in the repo — edit those natively.
- Diagrams/wireframes better built deterministically in HTML/CSS/canvas/SVG.
- The user explicitly wants the OpenAI Image API directly with size/quality/fidelity flags — that's Codex's CLI fallback path, not this one.
## Troubleshooting
- **"codex exec exited non-zero" / auth error** → run `codex login`.
- **"Could not find any generated image"** → Codex may have declined the prompt or chosen another tool. The wrapper falls back to diffing `$CODEX_HOME/generated_images/` before/after the run, so this usually only happens on refusal or a true failure; check the printed Codex output.
- **Slow** → normal; each run boots a Codex agent. Use `--timeout` to extend (default 300s).
```
Related in Ads & Marketing
ads
IncludedMulti-platform paid advertising audit and optimization skill. Analyzes Google, Meta, YouTube, LinkedIn, TikTok, Microsoft, and Apple Ads. 250+ checks with scoring, parallel agents, industry templates, and AI creative generation.
banana
IncludedAI image generation Creative Director powered by Google Gemini Nano Banana models. Use this skill for ANY request involving image creation, editing, visual asset production, or creative direction. Triggers on: generate an image, create a photo, edit this picture, design a logo, make a banner, visual for my anything, and all /banana commands. Handles text-to-image, image editing, multi-turn creative sessions, batch workflows, and brand presets.
rpg-migration-analyzer
IncludedAnalyzes legacy RPG (Report Program Generator) programs from AS/400 and IBM i systems for migration to modern Java applications. Extracts business logic from RPG III/IV/ILE source code, identifies data structures (D-specs), file operations (F-specs), program dependencies (CALLB/CALLP), and converts RPG constructs to Java equivalents. Generates migration reports, complexity estimates, and Java implementation strategies with POJO classes, JPA entities, and service methods. Use when modernizing AS/400 or IBM i legacy systems, analyzing RPG source files (.rpg, .rpgle, .RPGLE), converting RPG to Java, mapping data specifications to Java classes, planning legacy system migration, or when user mentions RPG analysis, Report Program Generator, RPG III/IV/ILE, AS/400 modernization, IBM i migration, packed decimal conversion, or mainframe application rewrite.
brand-library-architect
IncludedBuild a complete brand library for a product — visual asset render pipeline, brand documentation set (BRAND, COPY, MANIFESTO, BIOS, FAQ, GLOSSARY, TONE, PRICING), open-source convention files (README, CONTRIBUTING, SECURITY, CODE_OF_CONDUCT), and a self-contained press kit. This skill should be used when the user asks to "build a brand library / brand kit / press kit / brand assets" for a product, "set up a brand library workflow," "create a positioning manifesto plus visual identity," or any combination of brand documentation + visual asset pipeline. Apply phase-by-phase or run end-to-end. Templates are product-agnostic and use {{TOKEN}} placeholders the skill prompts the user to fill.
writing-tech-post
IncludedAuthors engineering blog posts end-to-end: launch deep-dives, incident postmortems, architecture migrations, performance case studies, tutorials, AI/agent system writeups, security disclosures, and research-to-product translations. Picks the correct archetype, plans the abstraction ladder, enforces an evidence cadence (diagrams, benchmarks, profiles, traces, code, ablations), tunes voice against publisher house styles (Datadog, Vercel, GitHub, AWS, Meta, Cloudflare, Jane Street), and runs a pre-publish gate for narrative momentum and disclosure ethics. Use when drafting a new engineering post, restructuring a draft that feels flat, deciding which evidence form belongs where, validating that depth and product context are balanced, or preparing a postmortem, migration, or performance narrative for external publication. Do not use for API reference documentation, README authoring, marketing copy, release notes, generic SEO content, ghost-written executive thought leadership, or non-engineering long-form essays.
blog-google
IncludedGoogle API integration for blog performance: PageSpeed Insights, CrUX Core Web Vitals with 25-week history, Search Console performance, URL Inspection, Indexing API, GA4 organic traffic, NLP entity analysis for E-E-A-T, YouTube video search for embedding, and Google Ads Keyword Planner. Progressive feature availability based on credential tier (API key, OAuth/service account, GA4, Ads). Shares config with claude-seo at ~/.config/claude-seo/google-api.json. Use when user says "google data", "page speed", "core web vitals", "search console", "indexation", "GA4", "keyword research", "nlp entities", "blog performance", "youtube search", "google api setup".