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.
This skill includes scripts your agent can run. See which files
Overview
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- Python 3.10+ with
google-genaipackage
Install dependencies:
pip install google-genai pillowQuick Start
Generate an image:
python3 <skill_dir>/scripts/generate.py "a cute robot mascot, pixel art style" -o robot.pngEdit an existing image:
python3 <skill_dir>/scripts/generate.py "make the background blue" -i input.jpg -o output.pngGenerate with specific aspect ratio:
python3 <skill_dir>/scripts/generate.py "cinematic landscape" --ratio 21:9 -o landscape.pngGenerate high-resolution 4K image:
python3 <skill_dir>/scripts/generate.py "professional product photo" --size 4K -o product.pngScript Reference
scripts/generate.py
Main image generation script.
Usage: generate.py [OPTIONS] PROMPT
Arguments:
PROMPT Text prompt for image generation
Options:
-o, --output PATH Output file path (default: auto-generated)
-i, --input PATH Input image for editing (optional)
-r, --ratio RATIO Aspect ratio (1:1, 16:9, 9:16, 21:9, etc.)
-s, --size SIZE Image size: 2K or 4K (default: standard)
--search Enable Google Search grounding for accuracy
-v, --verbose Show detailed outputSupported aspect ratios:
1:1- Square (default)2:3,3:2- Portrait/Landscape3:4,4:3- Standard4:5,5:4- Photo9:16,16:9- Widescreen21:9- Ultra-wide/Cinematic
scripts/batch_generate.py
Generate multiple images with sequential naming.
Usage: batch_generate.py [OPTIONS] PROMPT
Arguments:
PROMPT Text prompt for image generation
Options:
-n, --count N Number of images to generate (default: 10)
-d, --dir PATH Output directory
-p, --prefix STR Filename prefix (default: "image")
-r, --ratio RATIO Aspect ratio
-s, --size SIZE Image size (2K/4K)
--delay SECONDS Delay between generations (default: 3)Example:
python3 <skill_dir>/scripts/batch_generate.py "pixel art logo" -n 20 -d ./logos -p logoPython API
You can also use the module directly:
from generate import generate_image, edit_image
# Generate image
result = generate_image(
prompt="a futuristic city at night",
output_path="city.png",
aspect_ratio="16:9",
image_size="4K"
)
# Edit existing image
result = edit_image(
prompt="add flying cars to the sky",
input_path="city.png",
output_path="city_edited.png"
)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:
"A cozy coffee shop interior, warm lighting, vintage aesthetic,
wooden furniture, plants on shelves, morning sunlight through windows,
soft focus background, 35mm film photography style"Batch Generation Tips
- Generate 10-20 variations to explore options
- Use consistent prompts for style coherence
- Add 3-5 second delays to avoid rate limits
- 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
Troubleshooting
"API key not found"
- Set
GEMINI_API_KEYenvironment variable - Or pass via
--api-keyoption
"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 - Prompt examples by category
- examples/ - Example usage scripts
Files 5 files
Install it by hand
Deska runs this for you, for every agent you pick. To run it yourself in a terminal:
npx skills add resciencelab/opc-skills --skill nanobananaMore from resciencelab
- seo-georesciencelabSEO & GEO (Generative Engine Optimization) for websites. Analyze keywords, generate schema markup, optimize for AI search engines (ChatGPT, Perplexity, Gemini, Copilot, Claude) and traditional search (Google, Bing). Use when user wants to improve search visibility.50.9K installs on skills.sh0
- redditresciencelabSearch and retrieve content from Reddit. Get posts, comments, subreddit info, and user profiles via the public JSON API. Use when user mentions Reddit, a subreddit, or r/ links.3,400 installs on skills.sh0
- logo-creatorresciencelabCreate logos using AI image generation. Discuss style/ratio, generate variations, iterate with user feedback, crop, remove background, and export as SVG. Use when user wants to create a logo, icon, favicon, brand mark, mascot, emblem, or design a logo.3,100 installs on skills.sh0
- producthuntresciencelabSearch and retrieve content from Product Hunt. Get posts, topics, users, and collections via the GraphQL API. Use when user mentions Product Hunt, PH, or product launches.2,700 installs on skills.sh0
- twitterresciencelabSearch and retrieve content from Twitter/X. Get user info, tweets, replies, followers, communities, spaces, and trends via twitterapi.io. Use when user mentions Twitter, X, or tweets.2,100 installs on skills.sh0