Images through Codex (ChatGPT login, no API key)
Write a complete visual brief for each image and call the bundled script. The script runs one codex exec per image, in parallel, and saves a PNG at the exact path you choose.
One image
python "${CLAUDE_SKILL_DIR}/scripts/generate.py" "Matte blue and cream 3D metronome, studio light, plain background, no text." -o output/metronome.png --aspect 1:1
Many images at once
Write a jobs.json and run it with --batch:
[
{"id": "hero", "out": "output/hero.png", "aspect": "16:9", "prompt": "Wide shot of a lighthouse at dawn, soft fog, cinematic."},
{"id": "card", "out": "output/card.png", "aspect": "4:5", "prompt": "Same lighthouse as the reference, flat illustration, warm palette.", "refs": ["refs/lighthouse.jpg"]},
{"id": "icon", "out": "output/icon.png", "aspect": "1:1", "quality": "medium", "prompt": "Minimal lighthouse icon, single color, white background."}
]
python "${CLAUDE_SKILL_DIR}/scripts/generate.py" --batch jobs.json --parallel 4
- Only
promptandoutare required. Relative paths are resolved against the folder ofjobs.json. aspect: 1:1, 2:3, 3:2, 3:4, 4:3, 4:5, 5:4, 9:16, 16:9 (the image is center-cropped to the exact ratio).refs: reference images. Say in the prompt what each one is for ("keep the face of image 1", "use the layout of image 2").- Existing files are skipped, so you can rerun a batch after a failure.
--overwriteregenerates and keeps the old copy in_old/. --only id1,id2reruns just those jobs. Each run appends a log tojobs.log.jsonl.
Rules
- Wait for the script to finish, then open each result once and report the paths. Revise only when the user asks.
- Exit code
2= the ChatGPT plan's usage limit was reached and the batch stopped: tell the user and stop. Do not switch to an API key or another provider on your own. - Exit code
3= setup problem (Codex CLI missing or not logged in). The user fixes it withcodex login("Sign in with ChatGPT"). Never read, copy or edit authentication files. - "Blocked by moderation": rephrase the prompt (ambiguous words, real people, brands) and rerun only that job with
--only. - Small text inside images can come out misspelled: keep on-image text short and check it.
- Images in the same batch tend to repeat faces unless each prompt describes a different person.
- Requires Python 3.9+, the Codex CLI (
npm i -g @openai/codex) logged in with ChatGPT, and Pillow (pip install pillow) for exact cropping and non-PNG/JPEG references.