New advertisers: 50% off your first month with code FIRSTMONTHSee slots

AI image generation and editing plugin built on Google Gemini 3 Pro Image with reusable style templates.

version
2.3.0
GitHub stars
289
View on GitHub

What it does

  • Adds /generate, /edit, and /style commands plus image-generator and style-manager agents for image work
  • Covers text-to-image, image editing, reference images, batch variations, and eight aspect ratios from 1:1 to 21:9
  • Applies markdown style files from styles/ to prompts, with /style handling create, list, show, update, and delete
  • Designed for designers and content creators who need consistent visual styles across icons, thumbnails, and photo edits

AI image generation and editing using Google Gemini 3 Pro Image API. v2.3.0: Added explicit name: fields to commands for prefix-free invocation (/generate instead of /nanobanana:generate). Simple Node.js CLI with markdown styles and batch generation.

Add marketplace

/plugin marketplace add MadAppGang/claude-code

Run it inside Claude Code once, then install the plugin below.

Install

/plugin install nanobanana@mag-claude-plugins

Run it inside Claude Code after adding the marketplace.

Files

Discovered from source

plugin: nanobanana updated: 2026-01-20

Gemini Image API Reference

Quick Start

# Set API key
export GEMINI_API_KEY="your-key"

# Generate image
uv run python main.py output.png "A minimal 3D cube"

API Key Setup

  1. Visit: https://makersuite.google.com/app/apikey
  2. Create new API key
  3. Set environment variable:
    export GEMINI_API_KEY="your-api-key"
    

Supported Models

ModelResolutionBest For
gemini-3-pro-image-previewUp to 4KHigh quality
gemini-2.5-flash-imageUp to 1KQuick iterations

Aspect Ratios

RatioUse Case
1:1Social media, icons
3:4Portrait photos
4:3Traditional photos
4:5Instagram portrait
5:4Landscape photos
9:16Mobile, stories
16:9YouTube, desktop
21:9Cinematic, ultrawide

CLI Flags

FlagDescriptionExample
--styleApply style template--style styles/glass.md
--editEdit existing image--edit photo.jpg
--refReference image--ref style.png
--aspectAspect ratio--aspect 16:9
--modelModel ID--model gemini-2.5-flash-image
--max-retriesRetry attempts--max-retries 5

Error Codes

CodeMeaningRecovery
SUCCESSOperation completedN/A
API_KEY_MISSINGGEMINI_API_KEY not setExport the variable
FILE_NOT_FOUNDReferenced file missingCheck path
INVALID_INPUTBad prompt or argumentFix input
RATE_LIMITEDToo many requestsWait, uses auto-retry
NETWORK_ERRORConnection failedCheck network, auto-retry
API_ERRORGemini API errorCheck logs
CONTENT_POLICYBlocked promptAdjust content
TIMEOUTRequest timed outRetry
PARTIAL_FAILURESome batch items failedCheck individual results

Retry Behavior

The script automatically retries on transient errors:

  • Rate limits (429)
  • Server errors (502, 503)
  • Connection timeouts
  • Network errors

Retry uses exponential backoff: 1s, 2s, 4s, 8s, etc. Maximum retries configurable with --max-retries (default: 3)

Best Practices

  1. Prompts: Be specific about style, lighting, composition
  2. Styles: Use markdown templates for consistent results
  3. References: Provide visual examples for style matching
  4. Batch: Generate variations to pick the best
  5. Iteration: Edit results to refine
  6. Retries: Increase --max-retries for unreliable connections

Readme

Nano Banana Plugin

AI image generation and editing using Google Gemini 3 Pro Image API.

Version: 2.2.0 Category: media License: MIT

Features

  • Text-to-Image: Generate images from text prompts
  • Style Templates: Apply markdown-based style templates
  • Batch Generation: Generate multiple variations at once
  • Image Editing: Modify existing images with natural language
  • Reference Images: Use reference images for style consistency
  • Aspect Ratios: Support for 1:1, 3:4, 4:3, 9:16, 16:9, 21:9, and more
  • Node.js Native: No Python required, uses Node.js (already installed for Claude Code)

Installation

  1. Install the plugin via Claude Code:

    /plugin marketplace add MadAppGang/claude-code
    
  2. Enable in .claude/settings.json:

    {
      "enabledPlugins": {
        "nanobanana@mag-claude-plugins": true
      }
    }
    
  3. Set up your Gemini API key:

    export GEMINI_API_KEY="your-api-key"
    

    Get your API key from: https://makersuite.google.com/app/apikey

  4. Install dependencies:

    cd plugins/nanobanana
    npm install
    

Quick Start

Generate an Image

/nanobanana:generate "A minimal 3D cube on black background"

Create and Use a Style

# Create a style
/nanobanana:style create glass
# Describe: "3D glass material with blue tint, reflections, black background"

# Generate with style
/nanobanana:generate "gear icon" --style glass

Batch Generation

/nanobanana:generate "cube" "sphere" "pyramid" --style glass
# Creates: generated/cube_001.png, generated/cube_002.png, generated/cube_003.png

Edit an Image

/nanobanana:edit photo.jpg "Make the sky more dramatic"

With Reference Image

/nanobanana:generate "Same style but with a sphere" --ref previous_output.png

Commands

/nanobanana:generate

Generate images from text prompts.

Usage:

/nanobanana:generate "prompt" [--style name] [--aspect ratio] [--ref image]

Examples:

/nanobanana:generate "A serene mountain lake at sunset"
/nanobanana:generate "gear icon" --style glass
/nanobanana:generate "cube" "sphere" "pyramid" --style glass --aspect 1:1
/nanobanana:generate "landscape" --aspect 16:9

/nanobanana:edit

Edit existing images with natural language instructions.

Usage:

/nanobanana:edit <image> "instruction" [--ref image]

Examples:

/nanobanana:edit photo.jpg "Add dramatic sunset colors to the sky"
/nanobanana:edit logo.png "Change colors to blue and gold"
/nanobanana:edit scene.jpg "Add a rainbow" --ref rainbow_style.png

/nanobanana:style

Manage style templates.

Usage:

/nanobanana:style <action> [name]

Actions:

  • create - Create a new style
  • list - List all available styles
  • show - Display style contents
  • update - Update existing style
  • delete - Delete style (with confirmation)

Examples:

/nanobanana:style create watercolor
/nanobanana:style list
/nanobanana:style show glass
/nanobanana:style delete minimalist

Aspect Ratios

RatioUse Case
1:1Social media, icons
3:4Portrait photos
4:3Traditional photos
4:5Instagram portrait
5:4Landscape photos
9:16Mobile wallpapers, stories
16:9YouTube thumbnails, desktop
21:9Ultrawide, cinematic

Style System

Styles are simple markdown files stored in styles/ directory. The entire file content is used to enhance your prompts.

Style Template

# Style Name

{Vivid description of the visual style. Include:
- Overall aesthetic and mood
- Key visual characteristics
- Lighting and atmosphere
- Material properties if applicable}

## Color Palette
- Primary: {color} ({hex})
- Secondary: {color} ({hex})
- Background: {color} ({hex})

## Technical Notes
{Rendering style, camera angles, post-processing}

Example: Blue Glass 3D

# Blue Glass 3D Style

A photorealistic 3D render with blue glass material. Objects should have:
- Glossy, translucent blue glass surface
- Subtle reflections and refractions
- Solid black background
- Soft studio lighting from above-left
- Sharp shadows

## Color Palette
- Primary: Deep blue (#1a4b8c)
- Highlights: Light cyan (#7fdbff)
- Background: Pure black (#000000)

## Technical Notes
- Use ray-traced rendering appearance
- Include caustic light effects
- Maintain consistent material across objects

Environment Variables

VariableRequiredDescription
GEMINI_API_KEYYesGoogle AI API key for Gemini

Setup:

# macOS/Linux
export GEMINI_API_KEY="your-api-key"

# Add to shell profile for persistence
echo 'export GEMINI_API_KEY="your-key"' >> ~/.zshrc

Example Workflows

Workflow 1: Icon Set with Consistent Style

# 1. Create style
/nanobanana:style create glass
# Describe: "3D glass material with blue tint"

# 2. Generate first icon
/nanobanana:generate "home icon" --style glass

# 3. Use as reference for consistency
/nanobanana:generate "settings icon" --style glass --ref generated/home_icon.png
/nanobanana:generate "user icon" --style glass --ref generated/home_icon.png

Workflow 2: Photo Enhancement

# 1. Edit photo
/nanobanana:edit landscape.jpg "Add dramatic sunset sky"

# 2. Further refinement
/nanobanana:edit landscape_edited.png "Add birds flying in the distance"

# 3. Apply artistic style
/nanobanana:edit landscape_edited.png "Make it look painted" --ref painting_style.jpg

Workflow 3: YouTube Thumbnails

# Create style for consistent branding
/nanobanana:style create youtube_thumb
# Describe: "Bold text overlay, dramatic lighting, vibrant colors"

# Generate thumbnails at 16:9
/nanobanana:generate "Tech review" "Gaming" "Tutorial" --style youtube_thumb --aspect 16:9

Error Handling

The plugin includes robust error handling:

  • Automatic Retries: Transient errors (rate limits, network issues) are automatically retried with exponential backoff
  • Structured Error Codes: Clear error messages with actionable recovery steps
  • Partial Batch Support: If some images in a batch fail, successful ones are still saved
  • Input Validation: All inputs are sanitized before execution

Security

  • All user inputs are validated and sanitized
  • Style files are checked for injection patterns
  • Destructive operations require user confirmation
  • No secrets stored in files

Troubleshooting

"GEMINI_API_KEY not set"

Set your API key:

export GEMINI_API_KEY="your-key"

"Style file not found"

List available styles:

/nanobanana:style list

Rate Limit Errors

The plugin automatically retries with exponential backoff. You can increase retry attempts:

# Via CLI: --max-retries 5
node main.js out.png "prompt" --max-retries 5

Direct CLI Usage

You can use the Node.js script directly:

# Simple generation
node plugins/nanobanana/main.js output.png "A minimal 3D cube"

# With style
node plugins/nanobanana/main.js out.png "gear" --style styles/glass.md

# Batch generation
node plugins/nanobanana/main.js out.png "cube" "sphere" "pyramid"

# Edit image
node plugins/nanobanana/main.js edited.png "Make sky blue" --edit photo.jpg

# With reference
node plugins/nanobanana/main.js out.png "prompt" --ref style.png

# Aspect ratio
node plugins/nanobanana/main.js out.png "prompt" --aspect 16:9

# Show help
node plugins/nanobanana/main.js --help

Development

Requirements

  • Node.js 18+
  • Google Gemini API key

Running Tests

cd plugins/nanobanana

# Install dependencies
npm install

# Test API key setup
echo $GEMINI_API_KEY

# Test simple generation
node main.js test.png "A simple red circle"

License

MIT License - see LICENSE file for details.

Author

Jack Rudenko (i@madappgang.com) MadAppGang

Support

For issues and questions:

Changelog

v2.2.0 (2026-01-05)

Initial Release

  • Node.js implementation using @google/generative-ai
  • Uses Node.js (already available for Claude Code users)
  • Simple CLI: node main.js output.png "prompt" [options]

Features:

  • Text-to-image generation with Gemini 3 Pro Image
  • Markdown-based style system
  • Batch generation with multiple prompts
  • Image editing with natural language
  • Reference image support
  • Configurable aspect ratios

Security & Reliability:

  • Input sanitization with injection detection
  • Exponential backoff retry logic
  • Structured error codes
  • Destructive operation confirmation

Details

Marketplace
MadAppGang/claude-code
Source
plugins/nanobanana
Author
Jack Rudenko
Category
Media
Keywords
image-generation, ai-art, gemini, text-to-image, image-editing, style-transfer, nano-banana, google-ai
Listed since
Apr 6, 2026

More from MadAppGang/claude-code

All 9

Similar to nanobanana

More AI Image, Video & Voice