↓ Skip to main content

nano banana 2 · nano-banana Reference

Nano Banana 2 (gemini-3.1-flash-image) Model Card #

Overview #

Nano Banana 2 (gemini-3.1-flash-image) is Google’s multimodal creative workhorse model. It balances speed, spatial composition, and 4K output generation, featuring native web search grounding, image search grounding, and video context understanding.

  • Model Code: gemini-3.1-flash-image
  • CLI Aliases: nano-banana-2, gemini-3.1-flash-image
  • Release Date: May 28, 2026 (GA; preview released February 2026)
  • Status: Deprecated (October 6, 2026; no shutdown date announced. Migrate to gemini-nano-banana-2.1)
  • DeepMind Model Card: gemini-3-1-flash-image ↗

Technical Specifications #

PropertyValue
Input ModalitiesText, Images (up to 14), Video (YouTube URLs, MP4s), PDF
Output ModalitiesImage and Text (Interleaved)
Input Token Limit131,072 tokens
Output Token Limit32,768 tokens
Supported Resolutions512px (512 / 0.5K), 1K (1024px), 2K (2048px), 4K (4096px)
Aspect Ratios14 discrete ratios (incl. extreme wide/tall 1:4, 4:1, 1:8, 8:1)
Thinking ProcessSupported (minimal [default], high)
Search GroundingWeb Search Grounding + Google Image Search Grounding
Reference AnchorsUp to 10 object anchors + up to 4 character resemblance anchors
WatermarkingSynthID (Always On) + C2PA Metadata

Complete Resolution Grid & Token Consumption #

Aspect Ratio512px (0.5K)Tokens1K ResolutionTokens2K ResolutionTokens4K ResolutionTokens
1:1512 × 5127471024 × 10241,1202048 × 20481,6804096 × 40962,520
1:4256 × 1024747512 × 20481,1201024 × 40961,6802048 × 81922,520
1:8192 × 1536747384 × 30721,120768 × 61441,6801536 × 122882,520
2:3424 × 632747848 × 12641,1201696 × 25281,6803392 × 50562,520
3:2632 × 4247471264 × 8481,1202528 × 16961,6805056 × 33922,520
3:4448 × 600747896 × 12001,1201792 × 24001,6803584 × 48002,520
4:11024 × 2567472048 × 5121,1204096 × 10241,6808192 × 20482,520
4:3600 × 4487471200 × 8961,1202400 × 17921,6804800 × 35842,520
4:5464 × 576747928 × 11521,1201856 × 23041,6803712 × 46082,520
5:4576 × 4647471152 × 9281,1202304 × 18561,6804608 × 37122,520
8:11536 × 1927473072 × 3841,1206144 × 7681,68012288 × 15362,520
9:16384 × 688747768 × 13761,1201536 × 27521,6803072 × 55042,520
16:9688 × 3847471376 × 7681,1202752 × 15361,6805504 × 30722,520
21:9792 × 1687471584 × 6721,1203168 × 13441,6806336 × 26882,520

Capabilities & Key Features #

1. Google Search & Image Search Grounding #

Nano Banana 2 can query Google Search (both Web and Image Search) in real time to generate accurate images based on current events, sports scores, scientific diagrams, and real-world visual references.

python
interaction = client.interactions.create(
    model="gemini-3.1-flash-image",
    input="An infographic summarizing yesterday's European championship match highlights",
    tools=[{"type": "google_search", "search_types": ["web_search", "image_search"]}],
    response_format={"type": "image", "aspect_ratio": "16:9", "image_size": "2K"},
)

2. Video-to-Image Generation #

Pass YouTube URLs or local video files via the Files API to generate context-matched posters, scene captures, or thematic thumbnails:

python
interaction = client.interactions.create(
    model="gemini-3.1-flash-image",
    input=[
        {"type": "text", "text": "Generate a dramatic cinematic movie poster inspired by this trailer video"},
        {"type": "video", "uri": "https://www.youtube.com/watch?v=EXAMPLE_VIDEO_ID", "mime_type": "video/mp4"},
    ],
    response_format={"type": "image", "aspect_ratio": "2:3", "image_size": "4K"},
)

3. Controllable Thinking Process #

Control reasoning depth with thinking_level:

  • "minimal": Low latency, standard generation.
  • "high": Enhanced reasoning through composition, spatial arrangement, and complex lighting before pixel synthesis.

CLI & SDK Examples #

1. uv run scripts/banana.py: 4K High-Resolution Generation #

bash
uv run scripts/banana.py \
  -p "A cinematic wide-angle shot of an ancient observatory on a mountain peak under the Aurora Borealis" \
  -f "observatory_4k.png" \
  -m "nano-banana-2" \
  -r "4K" \
  -a "16:9" \
  --thinking-level "high"

2. gemini-api CLI: 4K High-Resolution Generation #

bash
gemini-api image "A cinematic wide-angle shot of an ancient observatory on a mountain peak under the Aurora Borealis" \
  -m gemini-3.1-flash-image \
  --aspect-ratio 16:9 \
  --image-size 4K \
  --body '{"generation_config":{"thinking_level":"high"}}' \
  --out observatory_4k.png

3. Python SDK (google-genai): 4K High-Resolution Generation #

python
import base64
from google import genai

client = genai.Client()

interaction = client.interactions.create(
    model="gemini-3.1-flash-image",
    input="A cinematic wide-angle shot of an ancient observatory on a mountain peak under the Aurora Borealis",
    generation_config={"thinking_level": "high"},
    response_format={
        "type": "image",
        "aspect_ratio": "16:9",
        "image_size": "4K",
    },
)

if interaction.output_image:
    with open("observatory_4k.png", "wb") as f:
        f.write(base64.b64decode(interaction.output_image.data))

4. Multi-Reference Character & Object Editing #

python
import base64
from google import genai

client = genai.Client()

with open("character_ref.png", "rb") as f:
    char_bytes = f.read()

with open("suit_ref.png", "rb") as f:
    suit_bytes = f.read()

interaction = client.interactions.create(
    model="gemini-3.1-flash-image",
    input=[
        {"type": "image", "data": base64.b64encode(char_bytes).decode("utf-8"), "mime_type": "image/png"},
        {"type": "image", "data": base64.b64encode(suit_bytes).decode("utf-8"), "mime_type": "image/png"},
        {"type": "text", "text": "Place the character from the first image into the cyberpunk armor from the second image, standing in a rain-soaked futuristic street."},
    ],
    response_format={"type": "image", "aspect_ratio": "16:9", "image_size": "2K"},
)

if interaction.output_image:
    with open("character_cyberpunk.png", "wb") as f:
        f.write(base64.b64decode(interaction.output_image.data))