Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
resciencelab avatar

Nanobanana

  • 2.6k installs
  • 1.2k repo stars
  • Updated July 27, 2026
  • resciencelab/opc-skills

nanobanana is an OPC skill for Gemini 3 Pro Image generation and editing with aspect ratios and 2K or 4K output.

About

Nano Banana generates and edits images using Google Gemini 3 Pro Image model gemini-3-pro-image-preview with text-to-image, image editing, aspect ratio control, and 2K or 4K resolution options. Prerequisites are GEMINI_API_KEY from Google AI Studio and Python 3.10 plus google-genai and pillow packages. The generate.py script accepts prompts with output path, optional input image for edits, ratio flags like 16:9 or 21:9, size 2K or 4K, and optional Google Search grounding for factual subjects. batch_generate.py produces sequential named outputs with configurable count, prefix, delay, and directory. Python API exposes generate_image and edit_image functions for programmatic use. Best practices stress detailed prompts with subject, style, lighting, composition, and color palette, plus 3 to 5 second delays between batch runs to respect rate limits. Troubleshooting covers missing API keys, safety filter empty responses, and quota exhaustion. Reference prompts.md and examples directory supplement category-specific prompt patterns.

  • Gemini 3 Pro Image text-to-image and edit flows.
  • Aspect ratios from 1:1 through 21:9 cinematic widescreen.
  • 2K and 4K resolution tiers with search grounding option.
  • batch_generate.py for sequential multi-image runs.
  • Python API with generate_image and edit_image helpers.

Nanobanana by the numbers

  • 2,582 all-time installs (skills.sh)
  • +52 installs in the week ending Jul 28, 2026 (Skillselion tracking)
  • Ranked #140 of 1,340 Generative Media skills by installs in the Skillselion catalog
  • Security screen: HIGH risk (skills.sh audit)
  • Data as of Jul 28, 2026 (Skillselion catalog sync)
At a glance

nanobanana capabilities & compatibility

Capabilities
cli text to image generation · image editing from input file · aspect ratio and 2k or 4k sizing · batch sequential image production · google search grounding toggle · python generate_image api
Works with
openai
Use cases
image generation · marketing
Pricing
Bring your own API key
From the docs

What nanobanana says it does

Generate and edit images using Google's Gemini 3 Pro Image model
SKILL.md
pip install google-genai pillow
SKILL.md
npx skills add https://github.com/resciencelab/opc-skills --skill nanobanana

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs2.6k
repo stars1.2k
Security audit2 / 3 scanners passed
Last updatedJuly 27, 2026
Repositoryresciencelab/opc-skills

How do I generate or edit images with Gemini image models from CLI or Python scripts?

Generate and edit images with Google Gemini 3 Pro Image via Python scripts supporting aspect ratios and 2K or 4K output.

Who is it for?

Users creating marketing visuals, product shots, or iterative image batches with Gemini image models.

Skip if: Skip for video generation, SVG vector art, or image hosting and CDN delivery setup.

When should I use this skill?

User wants AI image generation, Gemini image editing, or batch image creation with Nano Banana.

What you get

Saved PNG or JPG output from a prompt, optional edit pass, chosen ratio, and resolution tier.

  • 2K/4K generated images
  • Edited image files from prompts

By the numbers

  • Published as opc-skills version 1.0.0 with MIT license
  • Supports 2K and 4K image output resolutions

Files

SKILL.mdMarkdownGitHub ↗

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

  • references/prompts.md - Prompt examples by category
  • examples/ - Example usage scripts

Related skills

How it compares

Pick nanobanana over logo-creator when you need general Gemini image generation or editing at 2K/4K rather than SVG logo export.

FAQ

What API key is required?

Set GEMINI_API_KEY from Google AI Studio before running generate.py.

When use --search grounding?

Enable it for factually accurate images of real people, places, landmarks, or brands.

How avoid rate limits in batches?

Use batch_generate.py with 3 to 5 second delays between generations.

Is Nanobanana safe to install?

skills.sh reports 2 of 3 security scanners passed. Review the Security Audits panel on this page before installing in production.

Generative Mediallmautomation

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.