# generate-image

> Generate or edit images using AI models (FLUX, Nano Banana 2) for general-purpose image generation including photos, illustrations, artwork, visual assets, and concept art. For technical scientific diagrams, use scientific-schematics instead.

**Use case**: Generate photos, illustrations, and visual assets with AI

**Canonical URL**: https://agentcookbooks.com/skills/generate-image/

**Topics**: claude-code, skills, science, science

**Trigger phrases**: "generate an image", "create an illustration", "AI image generation", "make a photo of", "create visual assets"

**Source**: [K-Dense AI](https://github.com/K-Dense-AI/scientific-agent-skills/tree/main/scientific-skills/generate-image)

**License**: MIT

---

## What it does

`generate-image` is a Claude Code skill from K-Dense AI's [scientific-agent-skills repo](https://github.com/K-Dense-AI/scientific-agent-skills). It turns Claude into an image generation interface using FLUX and Nano Banana 2 AI models via OpenRouter — covering photorealistic image generation, illustrations, artwork, concept art, and general visual assets. The skill handles prompt construction, aspect ratio selection, and output file saving.

A session produces one or more generated image files at the specified dimensions and style, saved to the project directory. It is the general-purpose image generation counterpart to `scientific-schematics` (which is specialized for technical scientific diagrams).

## When to use it

Reach for it when:

- You need a photorealistic image, concept illustration, or visual asset for a presentation, report, or communication material
- You want to generate multiple image variations for a visual concept before selecting the best one
- You need blog or documentation imagery that doesn't involve precise technical diagrams

When *not* to reach for it:

- Technical scientific diagrams (flowcharts, biological pathways, neural network architectures) — use `scientific-schematics`
- Infographics with structured data and text — use `infographics`

## Install

Copy the `SKILL.md` from K-Dense AI's [generate-image folder](https://github.com/K-Dense-AI/scientific-agent-skills/tree/main/scientific-skills/generate-image) into `.claude/skills/generate-image/` in your project. Requires an OpenRouter API key set as `OPENROUTER_API_KEY`.

Trigger phrases: "generate an image", "create an illustration", "AI image generation", "make a photo of".

## What a session looks like

A typical session has three phases:

1. **Prompt and specification.** Describe the image: subject, style (photorealistic, illustration, watercolor, digital art), aspect ratio, and any specific elements to include or exclude. Claude refines the prompt for the target model.
2. **Generation.** The image is generated via the OpenRouter API using FLUX or Nano Banana 2. Claude selects the model based on the style request — FLUX for photorealistic outputs, Nano Banana 2 for illustrated or stylized outputs.
3. **Output.** The generated image is saved to the specified path and the file path is returned. Multiple variations can be generated with slightly different prompts for selection.

## Receipts

**Where it works well:**
- Concept illustrations for scientific communication — photorealistic representations of biological processes or chemical environments where artistic interpretation is acceptable
- Blog and documentation header images where the goal is visual engagement rather than scientific accuracy

**Where it backfires:**
- Precise molecular structures, specific protein conformations, or accurately labeled diagrams — AI image generation produces plausible-looking but scientifically inaccurate structures for these
- Text within generated images is frequently garbled; if your image needs readable text labels, use `infographics` or `scientific-schematics` instead

**Pattern that works:** separate the conceptual/artistic visual elements from the text label elements — generate the artwork, then add labels in a post-processing step using matplotlib or an image editor to ensure text accuracy.

## Source and attribution

Originally authored by [K-Dense Inc.](https://github.com/K-Dense-AI). The canonical SKILL.md lives in the [`generate-image` folder](https://github.com/K-Dense-AI/scientific-agent-skills/tree/main/scientific-skills/generate-image) of their public scientific-agent-skills repository.

License: MIT. Install, adapt, and redistribute with attribution preserved.

This page documents the skill from a practitioner's perspective. For the formal spec and any updates, defer to the source repo.