nanobanana
Generate and edit images using Google Gemini 3 Pro Image (Nano Banana Pro). Supports text-to-image, image editing, various aspect ratios, and high-resolution output (2K/4K). Use when user wants to generate images, create images, use Gemini image generation, or do AI image generation.
By resciencelab · 2,842 installs
npx skills add resciencelab/opc-skills --skill nanobanana
Source repository · Upstream listing
Nano Banana AI Image Generation
Generate and edit images using Google's Gemini 3 Pro Image model ( gemini 3 pro image preview , nicknamed "Nano Banana Pro" 🍌).
Prerequisites
Required:
GEMINI API KEY Get from [Google AI Studio](https://aistudio.google.com/apikey)
Python 3.10+ with google genai package
Install dependencies:
Quick Start
Generate an image:
Edit an existing image:
Generate with specific aspect ratio:
Generate high resolution 4K image:
Script Reference
scripts/generate.py
Main image generation script.
Supported aspect ratios:
1:1 Square (default)
2:3 , 3:2 Portrait/Landscape
3:4 , 4:3 Standard
4:5 , 5:4 Photo
9:16 , 16:9 Widescreen
21:9 Ultra wide/Cinematic
scripts/batch generate.py
Generate multiple images with sequential naming.
Example:
Python API
You can also use the module directly:
Environment Variables
Variable Description Default
GEMINI API KEY Google Gemini API key Required
IMAGE OUTPUT DIR Default output directory ./nanobanana images
Features
Text to Image Generation
Create images from text descriptions. The model excels at:
Photorealistic images
Artistic styles (pixel art, illustration, etc.)
Product photography
Landscapes and scenes
Image Editing
Transform existing images with natural language:
Style transfer
Object addition/removal
Background changes
Color adjustments
High Resolution Output
Standard : Fast generation, good quality
2K : Enhanced detail (2048px)
4K : Maximum quality (3840px), best for text rendering
Google Search Grounding
Enable search for factually accurate images involving:
Real people, places, landmarks
Current events
Specific products or brands
Best Practices
Prompt Writing
Good prompts include:
Subject description
Style/aesthetic
Lighting and mood
Composition details
Color palette
Example:
Batch Generation Tips
1. Generate 10 20 variations to explore options
2. Use consistent prompts for style coherence
3. Add 3 5 second delays to avoid rate limits
4. Review results and iterate on best candidates
Rate Limits
Gemini API has usage quotas
Add delays between batch generations
Check your quota at [Google AI Studio](https://aistudio.google.com/)
Troubleshooting
"API key not found"
Set GEMINI API KEY environment variable
Or pass via api key option
"No image in response"
Prompt may have triggered safety filters
Try rephrasing to avoid sensitive content
"Rate limit exceeded"
Wait a few seconds and retry
Reduce batch size or add longer delays
References
[references/prompts.md](./references/prompts.md) Prompt examples by category
[examples/](./examples/) Example usage scripts