gemini-image-generator
Generate images using Google's Gemini API. Use when creating images from text prompts, editing existing images, or combining reference images for AI-generated…

Install gemini-image-generator in Claude Code & Claude Desktop
Sign up to install this skill
Create a free account to reveal the install command and save the skill to your library.
- Reveal the one-line install command
- Save skills to your synced library
- Get notified when skills update
About this skill
Gemini Image Generator
Overview
Generate images using Google's Gemini API with support for text-to-image generation, image editing, and multi-image reference inputs. Gemini 3 Pro Image and Nano Banana 2.1 support up to 4K resolution.
Model naming note: These "Nano Banana" image models are distinct from the conversational Gemini models. See the models reference.
When to Use
- Generating app icons, logos, and UI assets
- Creating marketing visuals and promotional graphics
- Prototyping UI designs with AI-generated placeholders
- Generating game sprites and 2D assets
- Creating concept art and mood boards
- Editing or modifying existing images with text prompts
- Style transfer using reference images
Prerequisites
- Python 3.9+
google-genaipackage (1.49.0 or newer for 2K and 4K output)GEMINI_API_KEYenvironment variable
Installation
pip install google-genai
Getting an API Key
- Go to Google AI Studio
- Sign in with your Google account
- Click "Create API Key"
- Copy the key and set it as an environment variable:
export GEMINI_API_KEY="your-api-key"
Add to your shell profile (~/.zshrc or ~/.bashrc) for persistence:
echo 'export GEMINI_API_KEY="your-api-key"' >> ~/.zshrc
Quick Start
Generate a simple image:
python scripts/generate_image.py -p "A fluffy orange cat sitting on a windowsill, warm sunlight, cozy atmosphere"
Generate with specific aspect ratio:
python scripts/generate_image.py -p "Modern tech startup banner" -a 16:9 -o banner.png
Edit an existing image:
python scripts/generate_image.py -p "Make the sky more dramatic with sunset colors" -i photo.jpg -o edited.png
Command Reference
python scripts/generate_image.py [options]
Required:
-p, --prompt TEXT Text prompt describing the image
Optional:
-o, --output PATH Output file path (default: auto-generated)
-m, --model MODEL Model to use (default: gemini-3-pro-image)
-a, --aspect-ratio RATIO Aspect ratio (default: 1:1 for generation; match input image for edits)
-s, --size SIZE Image size: 1K, 2K, 4K (default: 1K; 2K/4K require Nano Banana 2.1 or Pro)
-i, --input-image PATH Input image for editing mode
-r, --reference-images Reference image(s), can be repeated (max 14)
-v, --verbose Show detailed progress
Models
| Model | Resolution | Best For | Nickname |
|---|---|---|---|
gemini-3-pro-image |
Up to 4K | Default; detailed visual work | Nano Banana Pro |
gemini-nano-banana-2.1 |
Up to 4K | Fast iteration at high resolution | Nano Banana 2.1 |
gemini-2.5-flash-image |
Up to 1K | Quick sketches and prototypes | Nano Banana |
Use gemini-2.5-flash-image for quick sketches when 1K is enough:
python scripts/generate_image.py -p "Quick concept sketch" -m gemini-2.5-flash-image
API usage: All models use the same
google-genaiSDK withresponse_modalities=['Image']in the config. The models requireGEMINI_API_KEYand use thegenerate_contentendpoint (not a separate images endpoint).
Aspect Ratios
| Ratio | Use Case |
|---|---|
1:1 |
App icons, profile pictures, thumbnails |
2:3 |
Portrait photos, book covers |
3:2 |
Landscape photos, postcards |
3:4 |
Portrait photos, social media posts |
4:3 |
Traditional photos, presentations |
4:5 |
Instagram posts, portrait social media |
5:4 |
Large format prints |
9:16 |
Stories, vertical videos, mobile wallpapers |
16:9 |
Widescreen banners, video thumbnails, headers |
21:9 |
Ultrawide banners, cinematic headers |
Image Sizes
Available for Gemini 3 Pro model only:
| Size | Resolution | Use Case |
|---|---|---|
1K |
1024px | Web graphics, thumbnails |
2K |
2048px | Print materials, detailed graphics |
4K |
4096px | High-resolution prints, large displays |
python scripts/generate_image.py -p "Detailed landscape" -s 4K -o landscape_4k.png
Prompt Engineering Guide
Prompt Structure
Use this formula for effective prompts:
[Subject] + [Style] + [Details] + [Quality modifiers]
Techniques
1. Be Specific About the Subject
Bad: "a cat"
Good: "a fluffy orange tabby cat sitting on a windowsill"
2. Specify Art Style
- Photorealistic, cartoon, anime, oil painting, watercolor
- Digital art, 3D render, pixel art, vector illustration
- Specific styles: "in the style of Studio Ghibli", "cyberpunk aesthetic"
3. Include Environment and Lighting
- "golden hour lighting", "dramatic shadows", "soft ambient light"
- "neon-lit cityscape", "cozy interior", "misty forest"
4. Add Quality Modifiers
- "high quality", "detailed", "professional"
- "sharp focus", "studio lighting", "cinematic"
5. Specify Composition
Allowed tools
Tools this skill is permitted to call.
No restriction — this skill can use any tool.
Bundled files
- scripts/generate_image.py
FAQ
What does the gemini-image-generator skill do?
Generate images using Google's Gemini API. Use when creating images from text prompts, editing existing images, or combining reference images for AI-generated visual content.
How do I install the gemini-image-generator skill?
Copy the skill folder into ~/.claude/skills (the Claude Code tab above does this in one command), or install it as a plugin.
Does the gemini-image-generator skill run scripts?
Yes, this skill bundles executable scripts. Review the source before installing.
Related skills
doc-coauthoring
AnthropicGuide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision…
academy-guide
AnthropicStop and check this skill before finishing any reply to a question about how to use Claude or a Claude product — it recommends matching courses, tutorials…
internal-comms
AnthropicA set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill…
skill-development
AnthropicThis skill should be used when the user wants to "create a skill", "add a skill to plugin", "write a new skill", "improve skill description", "organize skill…
