# Openai Image Gen

> OpenAI Images API: batches, prompt sampler, gallery — gpt-image-1 and variants.

- Skill: `mouadja02/openai-image-gen` (Agent Skill)
- Install (CLI): `npx skillmds@latest add mouadja02/openai-image-gen`
- Raw SKILL.md: https://api.skillmd.com/api/skills/mouadja02/openai-image-gen/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: AI & ML
- Author: mouadja02 (https://skillmd.com/u/mouadja02)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/mouadja02/openai-image-gen

---


# OpenAI Image Gen

> **Attribution:** Sourced from [steipete/agent-scripts](https://github.com/steipete/agent-scripts) by [Peter Steinberger](https://github.com/steipete).

## When to Use

- Generating images via OpenAI Images API (gpt-image-1)
- Running batch image generation with auto-generated HTML gallery
- Comparing prompt variations side by side

Generate images via OpenAI Images API with batch support and an auto-generated HTML gallery.

## Setup

- Requires `OPENAI_API_KEY` environment variable.
- Requires Python 3 and the `openai` package.

## Usage

```bash
# Basic run (generates random structured prompts)
python3 gen.py

# Custom count
python3 gen.py --count 16

# Custom model
python3 gen.py --model gpt-image-1.5

# Custom prompt
python3 gen.py --prompt "ultra-detailed studio photo of a lobster astronaut" --count 4

# Custom size and quality
python3 gen.py --size 1536x1024 --quality high --out-dir ./out/images
```

## Output

- `*.png` images in the output directory
- `prompts.json` (prompt ↔ file mapping)
- `index.html` (thumbnail gallery for quick review)

```bash
# Open gallery
open ~/tmp/openai-image-gen-*/index.html
```

## Common Options

| Flag | Description |
|------|-------------|
| `--count N` | Number of images to generate |
| `--model MODEL` | Model to use (e.g., `gpt-image-1`, `gpt-image-1.5`) |
| `--prompt TEXT` | Custom prompt (overrides random generation) |
| `--size WxH` | Image size (e.g., `1024x1024`, `1536x1024`) |
| `--quality LEVEL` | Quality level (`standard`, `high`) |
| `--out-dir PATH` | Output directory |

