home / skills / tyrchen / claude-skills / ai-image

ai-image skill

/ai-image

This skill generates AI images from text prompts using gpt-image-1 with configurable style and theme options to match your artistic vision.

npx playbooks add skill tyrchen/claude-skills --skill ai-image

Review the files below or copy the command above to add this skill to your agents.

Files (7)
SKILL.md
3.6 KB
---
name: ai-image
description: Generate AI images using OpenAI's gpt-image-1 model with customizable aspect ratios and artistic themes. Use when the user wants to create images, generate artwork, or mentions image generation with specific styles like Ghibli, futuristic, Pixar, oil painting, or Chinese painting.
---

# AI Image Generation Skill

Generate high-quality AI images using OpenAI's gpt-image-1 model with customizable styles and themes.

## When to Use This Skill

Use this skill when the user wants to:
- Generate images from text descriptions
- Create artwork with specific artistic styles
- Generate images with particular aspect ratios (vertical, horizontal, square)
- Apply themed visual styles (Studio Ghibli, futuristic, Pixar, oil painting, Chinese painting)

## Instructions

1. **Check for API Key**: Verify that the OPENAI_API_KEY environment variable is set
2. **Gather Requirements**: Ask the user for:
   - Image prompt (required)
   - Style/aspect ratio: vertical (1024x1536), horizontal (1536x1024), or square (1024x1024)
   - Theme: ghibli, futuristic, pixar, oil-paint, or chinese-paint (optional)
   - Output location (optional, defaults to ./generated_image.png)
3. **Run the CLI**: Execute the main.py script with the appropriate parameters
4. **Report Results**: Show the user where the image was saved and any relevant details

## Available Options

### Aspect Ratios (--style)
- `vertical`: 1024x1536 pixels (portrait orientation)
- `horizontal`: 1536x1024 pixels (landscape orientation)
- `square`: 1024x1024 pixels (default)

### Artistic Themes (--theme)
- `ghibli`: Studio Ghibli animation style with whimsical, dreamlike aesthetics
- `futuristic`: Sci-fi style with sleek designs and neon lights
- `pixar`: Vibrant 3D animation style with expressive characters
- `oil-paint`: Classical oil painting with rich textures and brushstrokes
- `chinese-paint`: Traditional Chinese ink painting with delicate brushwork

## Usage Examples

### Basic Usage
```bash
uv run main.py --prompt "a cat sitting on a tree"
```

### With Style and Theme
```bash
uv run main.py --prompt "a sunset over mountains" --style horizontal --theme oil-paint --output ./sunset.png
```

### Futuristic Portrait
```bash
uv run main.py --prompt "a robot in a city" --style vertical --theme futuristic --output ./robot.png
```

### Studio Ghibli Landscape
```bash
uv run main.py --prompt "a magical forest with spirits" --style horizontal --theme ghibli --output ./forest.png
```

## Setup Requirements

This skill requires an OpenAI API key with access to the gpt-image-1 model:

```bash
export OPENAI_API_KEY='your-api-key-here'
```

Note: Using gpt-image-1 requires organization verification on the OpenAI platform.

## Technical Details

- **Model**: OpenAI gpt-image-1 (released April 2025)
- **Response Format**: Base64 encoded images (b64_json)
- **Supported Sizes**: 1024x1024, 1024x1536, 1536x1024
- **Maximum Resolution**: Up to 4096x4096 pixels
- **Dependencies**: openai>=2.7.1

## Pricing Information

Usage is priced per token:
- Text tokens: $5 per million
- Image input tokens: $10 per million
- Image output tokens: $40 per million

Approximate costs per generated image:
- Low quality square: ~$0.02
- Medium quality square: ~$0.07
- High quality square: ~$0.19

## Troubleshooting

### API Key Not Set
If you see "Error: OPENAI_API_KEY environment variable not set", ensure your API key is exported in your shell session.

### Organization Not Verified
gpt-image-1 requires organization verification on platform.openai.com. Visit your OpenAI account settings to complete verification.

### Invalid Size Error
Ensure you're using one of the supported sizes: 1024x1024, 1024x1536, or 1536x1024.

Overview

This skill generates high-quality AI images using OpenAI's gpt-image-1 model with configurable aspect ratios and artistic themes. It helps you produce artwork from text prompts, export images to a file, and tailor results with styles like Ghibli, Pixar, oil painting, and more. The tool validates required settings and outputs base64-encoded images saved to your chosen path.

How this skill works

The skill accepts a text prompt, optional theme, and aspect ratio then calls the gpt-image-1 model to produce a base64-encoded image. Supported sizes are square (1024x1024), vertical (1024x1536), and horizontal (1536x1024); outputs are written to an output file path. It requires an OPENAI_API_KEY with access to gpt-image-1 and will report file location and basic cost/size details after generation.

When to use it

  • You want to create an image from a text description.
  • You need artwork in a specific aspect ratio (portrait, landscape, square).
  • You want an image in a specific visual theme (Ghibli, Pixar, oil painting, etc.).
  • You want scriptable CLI-driven image generation for batch or automated workflows.

Best practices

  • Provide a clear, detailed prompt including composition, colors, and subject to improve output.
  • Specify the aspect ratio early: vertical, horizontal, or square to match your use case.
  • Pick a theme when you want a consistent aesthetic across images.
  • Start with lower-cost settings to iterate, then increase quality or resolution for final renders.
  • Ensure OPENAI_API_KEY is set and your organization is verified for gpt-image-1 access.

Example use cases

  • Generate a promotional square image from a short marketing prompt.
  • Create a vertical futuristic portrait for a poster or profile art.
  • Render a landscape in an oil-paint style for print or illustration.
  • Produce a Studio Ghibli–style horizontal scenic image for social posts.
  • Batch-generate variations by scripting different prompts and themes.

FAQ

What environment variables are required?

Set OPENAI_API_KEY in your shell; gpt-image-1 may require organization verification on your OpenAI account.

Which sizes are supported?

Supported sizes are 1024x1024 (square), 1024x1536 (vertical), and 1536x1024 (horizontal); the tool also accepts higher resolutions up to the model's limits if configured.