Skip to content

jomeswang/codex-imagegen-batch

Repository files navigation

Codex Imagegen Batch

English | 简体中文

Generate many images from one short natural-language request. The plugin lightly optimizes the creative prompt, runs isolated codex exec image-generation jobs through the signed-in local Codex CLI, validates each PNG, and returns absolute paths with Markdown previews.

The user does not need to write execution instructions or a long image prompt.

Install

Requirements: Node.js 20+, an installed and signed-in Codex CLI, and the image_generation and fast_mode features.

codex plugin marketplace add jomeswang/codex-imagegen-batch
codex plugin add codex-imagegen-batch@jomeswang-image-tools

Start a new Codex task after installation so the skill is discovered.

One-line usage

Use $codex-imagegen-batch to generate 8 images of a little girl dancing, then return absolute paths and Markdown previews.

Implicit invocation also works:

Batch-generate 8 images of a little girl dancing and return absolute paths with Markdown previews.

Prompt optimization

The skill adapts the useful prompt-shaping rules from AI Media Canvas without copying its canvas workflow or its generate_image execution path.

  • A specific prompt is normalized, not expanded.
  • A vague prompt receives only material details: subject/action, style, framing, scene or mood, and constraints.
  • Ordinary prompts target one compact sentence or at most roughly 80 English words / 160 CJK characters.
  • Repeated variants keep one core prompt stable unless the user requests deliberate diversity.
  • Reference-image edits label each image role and use change only X; preserve Y invariants.

Example:

User: Generate 8 images of a little girl dancing.
Optimized core prompt: A cheerful little girl dancing, full-body, warm children's-book illustration, soft light, no text.

Detailed guidance is loaded from the skill's references/prompting.md only for complex edits, multiple reference roles, compositing, identity consistency, transparency, exact in-image text, specialized asset types, or explicit advanced optimization. Ordinary vague requests use the compact rules already present in the main skill and stay lightweight.

Text-to-image and reference images

Text-to-image:

Use $codex-imagegen-batch to generate 6 minimal 16:9 website backgrounds.

One reference image:

Use $codex-imagegen-batch to create 4 variants from /absolute/reference.png while preserving identity and composition.

Multiple reference images:

Use $codex-imagegen-batch to create 4 composites. Use /abs/scene.png as the base scene and /abs/person.png as the person.

The script's referenceImages field accepts local paths, HTTP(S) URLs, and data:image/...;base64,... data URLs. The built-in image_gen tool expects local referenced_image_paths, so the runner materializes URLs and data URLs as temporary local files first. A task may contain up to 16 references.

Run the script directly

node plugins/codex-imagegen-batch/scripts/codex-imagegen-batch.mjs \
  --input prompts.jsonl \
  --output-dir ./output \
  --concurrency 2

Each JSONL row represents one final image:

{"id":"dancing-girl-01","prompt":"A cheerful little girl dancing, full-body, warm children's-book illustration, soft light, no text","aspectRatio":"1:1","quality":"standard"}

The runner defaults to gpt-5.5 + low, disables user config, rules, and plugins, and does not load the built-in imagegen skill. It has no hard concurrency maximum; --concurrency accepts any positive integer, while effective concurrency never exceeds the task count.

Existing PNGs are never overwritten by default. Use --resume to continue a partial batch and --overwrite only when replacement is intentional.

node plugins/codex-imagegen-batch/scripts/codex-imagegen-batch.mjs --help

Output

The output directory contains PNG files and batch-report.json. The skill returns each file like this:

1. `/absolute/path/dancing-girl-01.png`

![dancing-girl-01](/absolute/path/dancing-girl-01.png)

An 8-image real-world test using gpt-5.5 + low, standard, 1:1, and concurrency 8 completed in 106.1 seconds; all eight outputs were valid 1254×1254 PNGs.

License

Original repository content is licensed under MIT. Prompting guidance adapted from the AI Media Canvas imagegen skill is licensed under Apache-2.0; see NOTICE.

This repository was created with the assistance of OpenAI Codex.

About

No description, website, or topics provided.

Resources

License

Stars

1 star

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors