codex-imagegen
Use this skill for raster image generation requests. Do not use it for SVG, vector-only,
or code-native assets unless the user explicitly wants a raster export.
The extracted extension implementation is kept with this skill under scripts/ for
reference and future edits:
scripts/index.ts — tool registration/background task orchestration
scripts/generate.ts — standalone CLI runner/smoke test for these scripts
scripts/codex-exec.ts — Codex backend command construction
scripts/icon.ts — icon batch detection, prompt rules, slicing script
scripts/transparent.ts — transparent-background detection/conversion script
scripts/prompts/ — prompt snippets/instructions
scripts/utils.ts — path, slug, MIME, shell helpers
Standalone script smoke test
You can run the extracted implementation without loading the pi extension:
bun .agents/skills/codex-imagegen/scripts/generate.ts \
--prompt "pixel-art cat on a blue cushion, no text" \
--out output/imagegen/codex-imagegen-skill-smoke-test.png \
--size 1024x1024 \
--quality draft \
--force
For icons:
bun .agents/skills/codex-imagegen/scripts/generate.ts \
--prompt "toolbar icon set, flat style" \
--icon "save icon" \
--icon "search icon" \
--out output/imagegen/toolbar-icons.png \
--force
Primary rule
Always use the codex_imagegen tool when the user asks for image generation or image
creation, even if they do not mention the tool by name.
codex_imagegen starts a background task and returns immediately. After calling it:
- Tell the user the background task id.
- Tell the user the expected output path.
- Tell the user the log path if returned.
- Do not wait for completion unless the user asks you to inspect progress.
Tool parameters
Use:
prompt: detailed visual prompt. Include subject, style, constraints, composition,
background, colors, mood, and any exact text.
out: output path. Prefer workspace-local paths under output/imagegen/.
size: requested size/aspect, e.g. 1024x1024, 2048x1152, wallpaper landscape.
quality: draft, low, medium, or high; default is high.
force: set true only when overwriting an existing file is intended.
transparent: set true for transparent-background requests.
icons: array of icon prompts for icon batches, max 16.
Transparent images
When the user asks for transparency, alpha, no background, or a transparent PNG:
- Set
transparent=true.
- The backend first renders on a flat solid green background, exactly
#008000.
- It then converts that green background to transparency and removes the temporary
green image.
- The prompt must avoid white/off-white/checkerboard backgrounds, shadows, gradients,
or texture in areas meant to be transparent.
Icons and icon sets
When the user asks for icons, favicons, app icons, toolbar icons, an icon set, or a
sprite sheet:
- Prefer the
icons parameter with one prompt per icon.
- Batch up to 16 icons per
codex_imagegen call.
- Icon generation automatically uses transparent output.
- The backend generates one
1024x1024 PNG sprite sheet, then slices icon outputs into
individual 64x64 transparent PNG files.
- Report both the grid output path and the generated icon output directory/files from
the tool result.
Icon prompt requirements used by the backend:
- One icon per grid slot, row-major from top-left.
- Identical padding/scale across icons.
- Crisp/readable at
64x64.
- No labels, captions, slot numbers, borders, grid lines, or extra decorative marks.
- Keep artwork fully inside its slot; no overlap.
- Leave unused slots empty background only.
Prompt construction checklist
For any generated image, make the prompt explicit:
- subject and key objects
- style/medium (photo, illustration, pixel art, 3D, flat vector-like raster, etc.)
- composition/camera/lighting
- color palette and mood
- background requirements
- size/aspect
- exact text, if any, quoted verbatim
- negative constraints (no watermark, no extra text, no border, etc.)
If the tool is unavailable
Do not fake a generated image with a placeholder unless the user asks for a placeholder.
Say the image-generation tool is unavailable in this harness/session and ask how they
want to proceed.
1---2name: codex-imagegen3description: Generate raster images with the codex_imagegen tool. Use whenever the user asks to create, generate, render, draw, or make a raster image, wallpaper, PNG/JPG/WebP, transparent image, favicon, app icon, toolbar icon, icon set, or sprite sheet.4---56# codex-imagegen78Use this skill for **raster image generation** requests. Do not use it for SVG, vector-only,9or code-native assets unless the user explicitly wants a raster export.1011The extracted extension implementation is kept with this skill under `scripts/` for12reference and future edits:1314- `scripts/index.ts` — tool registration/background task orchestration15- `scripts/generate.ts` — standalone CLI runner/smoke test for these scripts16- `scripts/codex-exec.ts` — Codex backend command construction17- `scripts/icon.ts` — icon batch detection, prompt rules, slicing script18- `scripts/transparent.ts` — transparent-background detection/conversion script19- `scripts/prompts/` — prompt snippets/instructions20- `scripts/utils.ts` — path, slug, MIME, shell helpers2122## Standalone script smoke test2324You can run the extracted implementation without loading the pi extension:2526```bash27bun .agents/skills/codex-imagegen/scripts/generate.ts \28 --prompt "pixel-art cat on a blue cushion, no text" \29 --out output/imagegen/codex-imagegen-skill-smoke-test.png \30 --size 1024x1024 \31 --quality draft \32 --force33```3435For icons:3637```bash38bun .agents/skills/codex-imagegen/scripts/generate.ts \39 --prompt "toolbar icon set, flat style" \40 --icon "save icon" \41 --icon "search icon" \42 --out output/imagegen/toolbar-icons.png \43 --force44```4546## Primary rule4748Always use the `codex_imagegen` tool when the user asks for image generation or image49creation, even if they do not mention the tool by name.5051`codex_imagegen` starts a background task and returns immediately. After calling it:52531. Tell the user the background task id.542. Tell the user the expected output path.553. Tell the user the log path if returned.564. Do **not** wait for completion unless the user asks you to inspect progress.5758## Tool parameters5960Use:6162- `prompt`: detailed visual prompt. Include subject, style, constraints, composition,63 background, colors, mood, and any exact text.64- `out`: output path. Prefer workspace-local paths under `output/imagegen/`.65- `size`: requested size/aspect, e.g. `1024x1024`, `2048x1152`, `wallpaper landscape`.66- `quality`: `draft`, `low`, `medium`, or `high`; default is `high`.67- `force`: set `true` only when overwriting an existing file is intended.68- `transparent`: set `true` for transparent-background requests.69- `icons`: array of icon prompts for icon batches, max 16.7071## Transparent images7273When the user asks for transparency, alpha, no background, or a transparent PNG:7475- Set `transparent=true`.76- The backend first renders on a flat solid green background, exactly `#008000`.77- It then converts that green background to transparency and removes the temporary78 green image.79- The prompt must avoid white/off-white/checkerboard backgrounds, shadows, gradients,80 or texture in areas meant to be transparent.8182## Icons and icon sets8384When the user asks for icons, favicons, app icons, toolbar icons, an icon set, or a85sprite sheet:8687- Prefer the `icons` parameter with one prompt per icon.88- Batch up to 16 icons per `codex_imagegen` call.89- Icon generation automatically uses transparent output.90- The backend generates one `1024x1024` PNG sprite sheet, then slices icon outputs into91 individual `64x64` transparent PNG files.92- Report both the grid output path and the generated icon output directory/files from93 the tool result.9495Icon prompt requirements used by the backend:9697- One icon per grid slot, row-major from top-left.98- Identical padding/scale across icons.99- Crisp/readable at `64x64`.100- No labels, captions, slot numbers, borders, grid lines, or extra decorative marks.101- Keep artwork fully inside its slot; no overlap.102- Leave unused slots empty background only.103104## Prompt construction checklist105106For any generated image, make the prompt explicit:107108- subject and key objects109- style/medium (photo, illustration, pixel art, 3D, flat vector-like raster, etc.)110- composition/camera/lighting111- color palette and mood112- background requirements113- size/aspect114- exact text, if any, quoted verbatim115- negative constraints (no watermark, no extra text, no border, etc.)116117## If the tool is unavailable118119Do not fake a generated image with a placeholder unless the user asks for a placeholder.120Say the image-generation tool is unavailable in this harness/session and ask how they121want to proceed.