imagegen

Generate and edit images via the OpenAI Image API using a bundled CLI.

Updated Feb 4, 2026
One-click install
npx skills add https://github.com/pchemguy/AISandbox --skill imagegen-pchemguy
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: imagegen
Source: https://github.com/pchemguy/AISandbox/tree/main/docs/AgentSkills/openai/skills/skills/.curated/imagegen
Command: npx skills add https://github.com/pchemguy/AISandbox --skill imagegen-pchemguy

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires openai, pillow, and includes scripts (resource) and references (resource) components.

What problem does it solve? Creating or editing images for projects (website heroes, product shots, UI mockups, game assets) normally requires manual design work or ad-hoc API scripting; this Skill provides a structured, repeatable workflow for generating and editing images through the OpenAI Image API. ## Core Features & Use Cases - Image Generation: Create new images from structured prompts with control over size, quality, background transparency, and output format, defaulting to the gpt-image-1.5 model. - Image Editing: Perform inpainting, background replacement, object removal, text localization, and compositing using input images and optional PNG masks, with input_fidelity control for strict edits. - Batch Generation: Run many prompts concurrently from a JSONL job file with retries, rate-limit handling, and per-job parameter overrides. - Use Case: A developer building a landing page asks for a hero image; the Skill classifies the request into a use-case taxonomy, augments the prompt with composition and constraint fields, runs the bundled CLI, and saves the final PNG under an output directory. ## Quick Start Ask the assistant to generate a hero image for your landing page using the imagegen skill, making sure your OPENAI_API_KEY environment variable is set first.

Frequently Asked Questions about imagegen

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I generate images with the OpenAI Image API from the command line?▼

Run the bundled CLI with the generate subcommand, for example: python image_gen.py generate --prompt "your prompt" --size 1024x1024. Live calls require the OPENAI_API_KEY environment variable and the openai Python package; use --dry-run to preview the request payload without an API call.

How do I edit or inpaint an existing image with a mask?▼

Use the edit subcommand with --image pointing to your input image and --mask pointing to a PNG mask with an alpha channel matching the image dimensions. Repeat invariants in the prompt (e.g., "change only the background") and consider --input-fidelity high for strict edits like identity preservation.

Can I generate many images in a batch concurrently?▼

Yes, the generate-batch subcommand reads a JSONL file with one job per line and runs jobs concurrently with a configurable --concurrency flag (default 5, max 25). Each job can override size, quality, background, and other parameters, and the CLI retries transient errors automatically.

What image sizes and formats does the OpenAI Image API support?▼

Supported sizes are 1024x1024, 1536x1024, 1024x1536, or auto, with output formats png, jpeg, and webp. Transparent backgrounds require png or webp output, and input images and masks must be under 50MB.

Why does the image generation CLI fail with an API key error?▼

The CLI exits with an error if OPENAI_API_KEY is not set before a live API call. Create a key at platform.openai.com/api-keys, export it as an environment variable in your shell, and re-run; --dry-run mode works without a key.