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

Nano Banana 2

  • 714 installs
  • 281 repo stars
  • Updated April 25, 2026
  • intellectronica/agent-skills

nano-banana-2 is a Cursor and Claude Code skill that generates and edits images through Google's Gemini 3.1 Flash Image Preview API for developers who need fast visual iteration with controlled aspect ratio and resolutio

About

nano-banana-2 is an agent skill that wraps Google's Nano Banana 2 model (`gemini-3.1-flash-image-preview`) in a Python script runnable via `uv run`. Developers pass a text prompt to `generate_image.py` to create new images or edit existing ones, with explicit aspect-ratio control and output sizes from 512px through 4K. The skill installs under `.agents/skills/nano-banana-2/` and is triggered when a user asks to create, modify, or iterate on images inside Cursor or Claude Code. Reach for nano-banana-2 when you need quick visual drafts for UI concepts, app store screenshots, documentation diagrams, or marketing creatives without leaving the coding agent. It requires a Gemini API key and network access but keeps iteration inside the agent workflow instead of switching to a separate design tool.

  • Generates new images from text prompts with explicit resolution and aspect-ratio control
  • Edits existing images using one or more reference images plus editing instructions
  • Supports four resolution modes: 512px (fastest), 1K (default), 2K, and 4K
  • Runs via simple CLI with uv from the active project directory so outputs land in context
  • Dedicated to the gemini-3.1-flash-image-preview model (Nano Banana 2)

Nano Banana 2 by the numbers

  • 714 all-time installs (skills.sh)
  • +31 installs in the week ending Aug 2, 2026 (Skillselion tracking)
  • Ranked #330 of 1,335 Generative Media skills by installs in the Skillselion catalog
  • Data as of Aug 2, 2026 (Skillselion catalog sync)
npx skills add https://github.com/intellectronica/agent-skills --skill nano-banana-2

Add your badge

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

Listed on Skillselion
Installs714
repo stars281
Last updatedApril 25, 2026
Repositoryintellectronica/agent-skills

How do you generate images from Cursor with Gemini?

Generate and edit images on demand directly from Cursor or Claude Code using Google's Gemini 3.1 Flash Image Preview model.

Who is it for?

Developers prototyping UI visuals, docs illustrations, or marketing assets who want Gemini 3.1 Flash Image Preview generation inside Cursor or Claude Code.

Skip if: Developers who need vector/SVG workflows, batch video generation, or a hosted design editor rather than API-driven image scripts.

When should I use this skill?

The user asks to create, edit, or iterate on images with aspect-ratio or resolution control using Nano Banana 2 or Gemini Flash Image Preview.

What you get

Generated or edited image files at chosen resolution and aspect ratio, saved from the `generate_image.py` script output.

  • PNG or JPEG image files
  • Edited image variants from prompts

By the numbers

  • Supports image resolutions from 512px through 4K
  • Uses the `gemini-3.1-flash-image-preview` model identifier

Files

SKILL.mdMarkdownGitHub ↗

Nano Banana 2 Image Generation & Editing

Generate new images or edit existing images with Nano Banana 2 (gemini-3.1-flash-image-preview).

Usage

Run the script using absolute or workspace-relative path (do NOT cd into the skill directory first):

Generate new image:

uv run ./.agents/skills/nano-banana-2/scripts/generate_image.py --prompt "your image description" --filename "output-name.png" [--resolution 512px|1K|2K|4K] [--aspect-ratio RATIO] [--api-key KEY]

Edit image(s) with references:

uv run ./.agents/skills/nano-banana-2/scripts/generate_image.py --prompt "editing instructions" --filename "output-name.png" --input-image "path/to/input1.png" [--input-image "path/to/input2.png" ...] [--resolution 512px|1K|2K|4K] [--aspect-ratio RATIO] [--api-key KEY]

Always run from the user's current working directory so outputs are saved in the active project context.

Model

Use model code:

  • gemini-3.1-flash-image-preview (Nano Banana 2)

Do not use gemini-3-pro-image-preview in this skill.

Resolution Options

Nano Banana 2 supports:

  • 512px (fastest, low-latency iteration)
  • 1K (default)
  • 2K
  • 4K

Map common user language:

  • "quick draft", "thumbnail", "tiny", "512", "0.5K" → 512px
  • no resolution mention → 1K
  • "2K", "medium", "normal" → 2K
  • "4K", "high-res", "ultra", "print quality" → 4K

Use uppercase K for 1K, 2K, 4K.

Aspect Ratios

Supported aspect ratios:

  • 1:1, 1:4, 1:8, 2:3, 3:2, 3:4, 4:1, 4:3, 4:5, 5:4, 8:1, 9:16, 16:9, 21:9

Map common requests:

  • square post / icon → 1:1
  • phone wallpaper / vertical reel → 9:16
  • widescreen / slide / hero image → 16:9
  • cinematic wide → 21:9
  • portrait print → 2:3 or 3:4
  • panorama banner → 4:1 or 8:1

If unspecified, let the model default behavior apply.

Reference Images (New in Gemini 3 Image workflows)

Provide up to 14 reference images when needed by repeating --input-image:

  • preserve character consistency
  • preserve object fidelity
  • combine multiple visual references into one output

Use one image for simple edits; use multiple images for composition or consistency-sensitive tasks.

API Key

Resolve API key in this order: 1. --api-key argument 2. GEMINI_API_KEY environment variable

If no key is available, stop and report a clear error.

Filename Generation

Generate filenames as: yyyy-mm-dd-hh-mm-ss-name.png

Examples:

  • 2026-02-26-17-31-04-japanese-garden.png
  • 2026-02-26-17-31-59-social-banner.png

Prompt Handling

For generation, pass the user's request as-is unless critically underspecified. For editing, include explicit transformation instructions in the prompt and preserve the original intent.

Output

  • Save PNG to the current directory (or to a provided path in --filename)
  • Return the full saved path(s)
  • Do not read the output image back unless explicitly requested

Examples

Create a 4K widescreen image:

uv run ./.agents/skills/nano-banana-2/scripts/generate_image.py --prompt "Futuristic city skyline at blue hour with neon reflections" --filename "2026-02-26-17-45-00-futuristic-skyline.png" --resolution 4K --aspect-ratio 16:9

Edit with multiple references:

uv run ./.agents/skills/nano-banana-2/scripts/generate_image.py --prompt "Create a polished campaign image that keeps the exact logo details and character identity" --filename "2026-02-26-17-50-10-campaign-image.png" --input-image "logo.png" --input-image "character.png" --resolution 2K --aspect-ratio 4:5

Related skills

How it compares

Choose nano-banana-2 when you need Gemini Flash Image Preview inside Cursor or Claude Code with script-level aspect-ratio and resolution control.

FAQ

What model does nano-banana-2 use?

nano-banana-2 calls Google's Nano Banana 2 model, documented as `gemini-3.1-flash-image-preview`, through a bundled Python script for generation and editing from agent sessions.

What image resolutions does nano-banana-2 support?

nano-banana-2 exposes resolution control from 512px up to 4K, plus explicit aspect-ratio settings, so developers can match UI, store, or docs dimensions without post-processing.

How do you run nano-banana-2 from an agent?

nano-banana-2 runs `uv run ./.agents/skills/nano-banana-2/scripts/generate_image.py --prompt "..."` using an absolute or workspace-relative path, without changing into the skill folder first.

This week in AI coding

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

unsubscribe anytime.