openai-image-gen

Generate images via OpenAI gpt-image-1.5 API. Supports batch generation with custom prompts or random prompt sampling. Features transparent backgrounds, multiple output formats (png/jpeg/webp), quality levels, and size options. Use when user wants to generate images, create image batches, explore visual prompts, or needs AI-generated artwork.

$ 설치

git clone https://github.com/LarsEckart/dotfiles /tmp/dotfiles && cp -r /tmp/dotfiles/agents/skills/openai-image-gen ~/.claude/skills/dotfiles

// tip: Run this command in your terminal to install the skill


name: openai-image-gen description: Generate images via OpenAI gpt-image-1.5 API. Supports batch generation with custom prompts or random prompt sampling. Features transparent backgrounds, multiple output formats (png/jpeg/webp), quality levels, and size options. Use when user wants to generate images, create image batches, explore visual prompts, or needs AI-generated artwork.

OpenAI Image Gen (gpt-image-1.5)

Batch-generate images using OpenAI's gpt-image-1.5 model with full API parameter support.

Workflow

1. Gather Requirements

For vague prompts, ask clarifying questions one at a time:

If unclear...Ask about
Subject/style"What style? (photo-realistic, illustration, painting, etc.)"
Use case suggests transparency"Need transparent background? (for logos, overlays, compositing)"
Orientation unclear"Landscape (1536x1024), portrait (1024x1536), or square?"
Web/app usage"Need compressed format? (webp/jpeg for smaller files)"
Batch vs single"How many variations?"

Skip questions when context is clear. E.g., "logo on transparent background" → no need to ask about background.

2. Generate

python3 ~/.dotfiles/agents/skills/openai-image-gen/scripts/gen.py [options]

3. Show Results

After generation, show the output path and offer to open the gallery.

Setup

Requires OPENAI_API_KEY environment variable.

Parameters

FlagValuesDefaultDescription
--countint8Number of images
--size1024x1024, 1536x1024, 1024x1536, auto1024x1024Dimensions
--qualitylow, medium, high, autohighQuality level
--backgroundtransparent, opaque, autoAPI defaultBackground type
--formatpng, jpeg, webppngOutput format
--compression0-100API defaultCompression (jpeg/webp only)
--moderationlow, autoAPI defaultContent moderation
--prompttextrandomCustom prompt (repeatable)
--out-dirpathautoOutput directory
--dry-runflag-Print prompts without API calls

Examples

# Custom prompt, landscape orientation
python3 ~/.dotfiles/agents/skills/openai-image-gen/scripts/gen.py \
  --prompt "a cozy cabin in snow, warm light from windows" \
  --size 1536x1024

# Transparent PNG for overlays
python3 ~/.dotfiles/agents/skills/openai-image-gen/scripts/gen.py \
  --prompt "a floating crystal orb with internal glow" \
  --background transparent

# Compressed webp for web use
python3 ~/.dotfiles/agents/skills/openai-image-gen/scripts/gen.py \
  --prompt "minimalist logo, geometric shapes" \
  --format webp --compression 80

# Multiple prompts
python3 ~/.dotfiles/agents/skills/openai-image-gen/scripts/gen.py \
  --prompt "sunset over mountains" \
  --prompt "northern lights over lake" \
  --prompt "milky way over desert"

# Preview prompts without generating
python3 ~/.dotfiles/agents/skills/openai-image-gen/scripts/gen.py --count 4 --dry-run

Output

  • Image files (*.png, *.jpg, or *.webp)
  • prompts.json — prompt ↔ file mapping
  • index.html — thumbnail gallery

Output goes to ~/Projects/tmp/openai-image-gen-{timestamp}/ if that directory exists, otherwise ./tmp/.