# Generate Image

Generate or edit images using AI models (FLUX, Gemini).

- Repository: https://github.com/ynulihao/AgentSkillOS (618 stars)
- Category: Data and ML
- License: see repository
- Last updated: 2026-03-07
- Runs scripts: yes, review before use

## Install

Claude Code: `npx skills add ynulihao/AgentSkillOS --skill generate-image -g -a claude-code -y`
Codex: `npx skills add ynulihao/AgentSkillOS --skill generate-image -g -a codex -y`
Cursor: `npx skills add ynulihao/AgentSkillOS --skill generate-image -g -a cursor -y`
Gemini CLI: `npx skills add ynulihao/AgentSkillOS --skill generate-image -g -a gemini-cli -y`

## Description

Generate or edit images using AI models (FLUX, Gemini). Use for general-purpose image generation including photos, illustrations, artwork, visual assets, concept art, and any image that isn't a technical diagram or schematic. For flowcharts, circuits, pathways, and technical diagrams, use the scientific-schematics skill instead.

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# Generate Image

Generate and edit high-quality images using OpenRouter's image generation models including FLUX.2 Pro and Gemini 3 Pro.

## When to Use This Skill

**Use generate-image for:**
- Photos and photorealistic images
- Artistic illustrations and artwork
- Concept art and visual concepts
- Visual assets for presentations or documents
- Image editing and modifications
- Any general-purpose image generation needs

**Use scientific-schematics instead for:**
- Flowcharts and process diagrams
- Circuit diagrams and electrical schematics
- Biological pathways and signaling cascades
- System architecture diagrams
- CONSORT diagrams and methodology flowcharts
- Any technical/schematic diagrams

## Quick Start

Use the `scripts/generate_image.py` script to generate or edit images:

```bash
# Generate a new image
python scripts/generate_image.py "A beautiful sunset over mountains"

# Edit an existing image
python scripts/generate_image.py "Make the sky purple" --input photo.jpg
```

This generates/edits an image and saves it as `generated_image.png` in the current directory.

## API Key Setup

**CRITICAL**: The script requires an OpenRouter API key. Before running, check if the user has configured their API key:

1. Look for a `.env` file in the project directory or parent directories
2. Check for `OPENROUTER_API_KEY=<key>` in the `.env` file
3. If not found, inform the user they need to:
   - Create a `.env` file with `OPENROUTER_API_KEY=your-api-key-here`
   - Or set the environment variable: `export OPENROUTER_API_KEY=your-api-key-here`
   - Get an API key from: https://openrouter.ai/keys

The script will automatically detect the `.env` file and provide clear error messages if the API key is missing.

## Model Selection

**Default model**: `google/gemini-3-pro-image-preview` (high quality, recommended)

The rest: https://github.com/ynulihao/AgentSkillOS/blob/HEAD/data/skill_seeds/generate-image/SKILL.md
