PluginBench
Skill
Fail
Audit score 45

nanobanana

resciencelab/opc-skills

Generate and edit images using Google Gemini 3 Pro Image with text-to-image, editing, and 4K output.

What is nanobanana?

Nano Banana uses Google's Gemini 3 Pro Image model to generate images from text prompts and edit existing images. Use it when you need AI image generation, style transfer, or high-resolution output up to 4K.

  • Generate images from text prompts with customizable aspect ratios (1:1, 16:9, 21:9, etc.)
  • Edit existing images with natural language instructions (style transfer, object addition, background changes)
  • Output high-resolution images in standard, 2K, or 4K sizes
  • Batch generate multiple image variations with sequential naming
  • Enable Google Search grounding for factually accurate images of real people, places, and landmarks

How to install nanobanana

npx skills add https://github.com/resciencelab/opc-skills --skill nanobanana
Prerequisites
  • GEMINI_API_KEY from Google AI Studio (https://aistudio.google.com/apikey)
  • Python 3.10 or higher
  • google-genai and pillow packages (install via: pip install google-genai pillow)
Claude Code
Cursor
Windsurf
Cline

How to use nanobanana

  1. 1.Set your GEMINI_API_KEY environment variable with your Google API key
  2. 2.Run generate.py with a text prompt to create an image: python3 scripts/generate.py "your prompt" -o output.png
  3. 3.For image editing, provide an input image: python3 scripts/generate.py "edit description" -i input.jpg -o output.png
  4. 4.Specify aspect ratio with --ratio (e.g., 16:9 for widescreen) and size with --size (2K or 4K for higher quality)
  5. 5.For batch generation, use batch_generate.py with -n flag to create multiple variations: python3 scripts/batch_generate.py "prompt" -n 20 -d ./output_dir

Use cases

Good for
  • Create product photography or marketing visuals from descriptions
  • Generate pixel art logos or icons in bulk with batch processing
  • Edit photos by changing backgrounds, adding objects, or adjusting colors
  • Produce cinematic landscapes or concept art with specific aspect ratios
  • Generate variations of a design to explore different styles and compositions
Who it's for
  • Designers and creative professionals needing quick image generation
  • Content creators producing marketing or social media assets
  • Product teams prototyping visual concepts
  • Developers building image generation into applications

nanobanana FAQ

What aspect ratios are supported?

Supported ratios include 1:1 (square), 2:3, 3:2, 3:4, 4:3, 4:5, 5:4, 9:16, 16:9, and 21:9 (ultra-wide/cinematic).

How do I generate high-resolution images?

Use the --size flag with 2K or 4K: python3 scripts/generate.py "prompt" --size 4K -o output.png. 4K provides maximum quality and best text rendering.

Can I edit existing images?

Yes, use the -i flag to provide an input image: python3 scripts/generate.py "edit description" -i input.jpg -o output.png. The model supports style transfer, object addition/removal, and color adjustments.

What should I do if the API returns no image?

The prompt may have triggered safety filters. Try rephrasing to avoid sensitive content. You can also enable Google Search grounding with --search for factually accurate images.

How do I avoid rate limiting when generating many images?

Use batch_generate.py with the --delay flag to add pauses between requests (default 3 seconds). Check your quota at Google AI Studio and reduce batch size if needed.

Full instructions (SKILL.md)

Source of truth, from resciencelab/opc-skills.


name: nanobanana description: 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.

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-genai package

Install dependencies:

pip install google-genai pillow

Quick Start

Generate an image:

python3 <skill_dir>/scripts/generate.py "a cute robot mascot, pixel art style" -o robot.png

Edit an existing image:

python3 <skill_dir>/scripts/generate.py "make the background blue" -i input.jpg -o output.png

Generate with specific aspect ratio:

python3 <skill_dir>/scripts/generate.py "cinematic landscape" --ratio 21:9 -o landscape.png

Generate high-resolution 4K image:

python3 <skill_dir>/scripts/generate.py "professional product photo" --size 4K -o product.png

Script 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 output

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.

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 logo

Python 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

VariableDescriptionDefault
GEMINI_API_KEYGoogle Gemini API keyRequired
IMAGE_OUTPUT_DIRDefault 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

  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

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