Guide

How to Use Nano Banana Pro (Gemini 3 Pro Image) for Developers in 2025

Complete developer guide to integrating Google's Nano Banana Pro (Gemini 3 Pro Image) API into your applications. Learn setup, API calls, and best practices.

By AI Coding Tools Directory2025-01-2210 min read
ACTD
AI Coding Tools Directory

Editorial Team

The AI Coding Tools Directory editorial team researches, tests, and reviews AI-powered development tools to help developers find the best solutions for their workflows.

Introduction

On November 20, 2025, Google launched Nano Banana Pro (officially "Gemini 3 Pro Image"), their most advanced AI image generation model built on Gemini 3 Pro. While the consumer version is available through the Gemini app, developers can integrate this powerful image generator into their applications via the Gemini API.

This guide will show you how to set up and use Nano Banana Pro for developers, including API access, code examples, and best practices.

What is Nano Banana Pro?

Nano Banana Pro is Google's state-of-the-art image generation and editing model with unique capabilities:

Key Features:

High-Resolution Output:

  • Generates 1K, 2K, and 4K visuals
  • Output files up to 24.1MB (5632 × 3072 pixels)

Advanced Text Rendering:

  • Creates legible, stylized text in images
  • Supports multiple languages
  • Perfect for infographics, menus, diagrams, marketing assets

Grounding with Google Search:

  • Uses real-time Google Search data
  • Can generate current weather maps, stock charts, recent events
  • Fact-checking built into the generation process

Professional Controls:

  • Camera angles and scene lighting
  • Depth of field and focus
  • Color grading
  • Detailed artistic control

Deep Thinking Layer:

  • Reasoning-integrated image engine
  • Deconstructs requests before generating pixels
  • First commercial deployment of cognitive pre-processing

Prerequisites

Before starting, you'll need:

Google Cloud Account (free tier available) ✅ Gemini API access (sign up at Google AI Studio) ✅ Programming knowledge (Python, JavaScript, or other languages) ✅ API key from Google AI Studio

Step 1: Get Your Gemini API Key

1.1. Create a Google AI Studio Account

  1. Visit Google AI Studio
  2. Click "Get API key"
  3. Sign in with your Google account
  4. Accept the terms of service

1.2. Generate Your API Key

1. In Google AI Studio, click "Get API key in Google AI Studio"
2. Click "Create API key"
3. Select existing Google Cloud project or create new one
4. Copy your API key (starts with "AIza...")
5. Store securely (never commit to version control!)

1.3. Store API Key Securely

Option 1: Environment Variable (Recommended)

# Linux/macOS
export GEMINI_API_KEY="your_api_key_here"

# Windows PowerShell
$env:GEMINI_API_KEY="your_api_key_here"

Option 2: .env File

# Create .env file
echo "GEMINI_API_KEY=your_api_key_here" > .env

# Add to .gitignore
echo ".env" >> .gitignore

Step 2: Install the Gemini SDK

For Python Developers:

# Install the Google Generative AI Python library
pip install google-generativeai

# Verify installation
python -c "import google.generativeai as genai; print('✅ SDK installed')"

For JavaScript/Node.js Developers:

# Install the Gemini API Node.js library
npm install @google/generative-ai

# Verify installation
node -e "const genai = require('@google/generative-ai'); console.log('✅ SDK installed')"

Step 3: Your First Image Generation (Python)

Basic Image Generation

import google.generativeai as genai
import os
from pathlib import Path

# Configure API key
genai.configure(api_key=os.environ.get("GEMINI_API_KEY"))

# Initialize the Gemini 3 Pro Image model (Nano Banana Pro)
model = genai.GenerativeModel('gemini-3-pro-image-preview')

# Generate an image
prompt = "A serene Japanese garden with cherry blossoms, koi pond, and traditional bridge at sunset"

response = model.generate_content([prompt])

# Save the generated image
if response.candidates:
    image_data = response.candidates[0].content.parts[0].inline_data.data

    # Save to file
    with open("generated_image.png", "wb") as f:
        f.write(image_data)

    print("✅ Image generated successfully: generated_image.png")
else:
    print("❌ No image generated")

Advanced Generation with Professional Controls

import google.generativeai as genai
import os

genai.configure(api_key=os.environ.get("GEMINI_API_KEY"))
model = genai.GenerativeModel('gemini-3-pro-image-preview')

# Detailed prompt with professional controls
prompt = """
Create a product photography image with these specifications:
- Subject: Modern wireless headphones in matte black
- Camera: 50mm lens, f/2.8 aperture
- Lighting: Soft box lighting from 45-degree angle
- Background: Gradient from dark gray to light gray
- Focus: Sharp focus on headphones, subtle bokeh in background
- Color grading: Cool tones, slightly desaturated
- Resolution: 4K quality
- Style: Professional e-commerce product shot
"""

response = model.generate_content(
    [prompt],
    generation_config={
        "temperature": 0.7,  # Creativity level (0.0-1.0)
        "top_p": 0.9,        # Nucleus sampling
        "top_k": 40,         # Top-k sampling
    }
)

# Save high-quality output
if response.candidates:
    image = response.candidates[0].content.parts[0].inline_data.data
    with open("product_photo_4k.png", "wb") as f:
        f.write(image)
    print("✅ High-quality image generated")

Step 4: Your First Image Generation (JavaScript)

Node.js Example

const { GoogleGenerativeAI } = require("@google/generative-ai");
const fs = require('fs').promises;

async function generateImage() {
    // Initialize the Gemini API
    const genAI = new GoogleGenerativeAI(process.env.GEMINI_API_KEY);

    // Get the Gemini 3 Pro Image model (Nano Banana Pro)
    const model = genAI.getGenerativeModel({ model: "gemini-3-pro-image-preview" });

    const prompt = "A futuristic cityscape with flying cars and neon lights at night";

    try {
        const result = await model.generateContent([prompt]);
        const response = await result.response;

        // Extract image data
        const imageData = response.candidates[0].content.parts[0].inlineData.data;

        // Convert base64 to buffer and save
        const buffer = Buffer.from(imageData, 'base64');
        await fs.writeFile('generated_cityscape.png', buffer);

        console.log('✅ Image generated successfully: generated_cityscape.png');
    } catch (error) {
        console.error('❌ Error generating image:', error);
    }
}

generateImage();

Step 5: Using Google Search Grounding

One of Nano Banana Pro's unique features is grounding with Google Search for fact-based image generation:

import google.generativeai as genai
import os

genai.configure(api_key=os.environ.get("GEMINI_API_KEY"))
model = genai.GenerativeModel('gemini-3-pro-image-preview')

# Use grounding for real-time, fact-based generation
prompt = """
Create an infographic showing:
- Current weather map of California
- Temperature data for major cities (San Francisco, Los Angeles, San Diego)
- Use real, current weather data via Google Search
- Clean, modern design with temperature gradients
"""

response = model.generate_content(
    [prompt],
    tools=[{"google_search": {}}]  # Enable Google Search grounding
)

# This will generate an image using REAL current weather data
if response.candidates:
    image = response.candidates[0].content.parts[0].inline_data.data
    with open("weather_map.png", "wb") as f:
        f.write(image)
    print("✅ Grounded image with real data generated")

Step 6: Image Editing (Not Just Generation)

Nano Banana Pro can also edit existing images:

import google.generativeai as genai
import os
from PIL import Image

genai.configure(api_key=os.environ.get("GEMINI_API_KEY"))
model = genai.GenerativeModel('gemini-3-pro-image-preview')

# Upload an existing image
with open("original_photo.jpg", "rb") as f:
    uploaded_file = genai.upload_file(f, mime_type="image/jpeg")

# Edit the image
edit_prompt = "Change the time of day to golden hour sunset, enhance warm tones, add soft lens flare"

response = model.generate_content([uploaded_file, edit_prompt])

# Save edited image
if response.candidates:
    edited_image = response.candidates[0].content.parts[0].inline_data.data
    with open("edited_photo.png", "wb") as f:
        f.write(edited_image)
    print("✅ Image edited successfully")

Step 7: Batch Image Generation

Generate multiple variations efficiently:

import google.generativeai as genai
import os

genai.configure(api_key=os.environ.get("GEMINI_API_KEY"))
model = genai.GenerativeModel('gemini-3-pro-image-preview')

base_prompt = "A minimalist logo for a tech startup called"

company_names = ["CloudSync", "DataFlow", "CodeNest", "AIGrowth", "DevHub"]

for i, company in enumerate(company_names):
    prompt = f"{base_prompt} {company}, modern, clean, memorable"

    response = model.generate_content([prompt])

    if response.candidates:
        image = response.candidates[0].content.parts[0].inline_data.data
        with open(f"logo_{company.lower()}.png", "wb") as f:
            f.write(image)
        print(f"✅ Generated logo for {company}")

Best Practices

1. Craft Effective Prompts

Good Prompt:

"Professional headshot of a business executive,
50mm lens, studio lighting, neutral gray background,
sharp focus, high resolution"

Bad Prompt:

"make a picture of a person"

2. Use the "Deep Thinking" Feature

Nano Banana Pro has a reasoning layer. Leverage it:

# Detailed, logical prompts work best
prompt = """
Step-by-step reasoning for image generation:
1. Subject: Modern electric car
2. Setting: Futuristic charging station
3. Lighting: Morning golden hour, soft shadows
4. Composition: 3/4 view, rule of thirds
5. Style: Photorealistic, automotive photography
6. Details: Reflections on car surface, visible charging cable
"""

3. Handle Errors Gracefully

import google.generativeai as genai
import os

genai.configure(api_key=os.environ.get("GEMINI_API_KEY"))
model = genai.GenerativeModel('gemini-3-pro-image-preview')

try:
    response = model.generate_content([prompt])

    if response.candidates:
        # Success
        image = response.candidates[0].content.parts[0].inline_data.data
        with open("output.png", "wb") as f:
            f.write(image)
    else:
        print("❌ No image generated. Possible content policy violation.")

except Exception as e:
    print(f"❌ Error: {e}")
    # Log error, retry with modified prompt, or alert user

4. Respect Rate Limits

import time

images_to_generate = 10
for i in range(images_to_generate):
    response = model.generate_content([f"Image {i}"])
    # ... save image ...

    # Respect rate limits (adjust based on your quota)
    time.sleep(2)  # 2 second delay between requests

5. Optimize for Cost

Nano Banana Pro pricing (as of Jan 2025):

  • Check current pricing at Google AI Studio pricing
  • Free tier: Limited requests per month
  • Paid: Per-image generation pricing

Cost optimization:

# Cache prompts when generating variations
base_config = {
    "temperature": 0.7,
    "top_p": 0.9,
}

# Reuse configuration across requests
for prompt in prompts:
    response = model.generate_content([prompt], generation_config=base_config)

Common Use Cases for Developers

1. E-Commerce Product Mockups

Generate product photos without expensive photoshoots.

2. Marketing Asset Generation

Create social media graphics, ads, banners on-the-fly.

3. Game Asset Creation

Generate textures, backgrounds, concept art for games.

4. UI/UX Prototyping

Create placeholder images and illustrations for mockups.

5. Content Personalization

Generate custom images per user (profile backgrounds, themes).

6. Data Visualization

Create infographics from data (with Google Search grounding).

Troubleshooting

Issue: "API key not valid"

Solution:

# Verify API key format
echo $GEMINI_API_KEY  # Should start with "AIza..."

# Regenerate key in Google AI Studio if needed

Issue: No image in response

Possible causes:

  • Content policy violation (inappropriate prompt)
  • API quota exceeded
  • Invalid prompt format

Solution:

# Check response structure
print(response)
print(response.candidates)

# Modify prompt to be more specific and policy-compliant

Issue: Low-quality images

Solution:

# Request higher resolution explicitly
prompt = "... [your prompt] ..., 4K resolution, high detail, sharp focus"

# Adjust generation parameters
generation_config = {
    "temperature": 0.6,  # Lower = more coherent
    "top_p": 0.85,
}

Next Steps

Now that you know the basics:

  1. Explore the official docs: Google AI Gemini API Documentation
  2. Join the community: Google AI Developer Discord
  3. Experiment with prompts: Try different styles and controls
  4. Build something: Integrate Nano Banana Pro into your app!

Example: Complete Web App (Flask + Nano Banana Pro)

from flask import Flask, request, send_file, jsonify
import google.generativeai as genai
import os
import io

app = Flask(__name__)

genai.configure(api_key=os.environ.get("GEMINI_API_KEY"))
model = genai.GenerativeModel('gemini-3-pro-image-preview')

@app.route('/generate', methods=['POST'])
def generate_image():
    data = request.json
    prompt = data.get('prompt', '')

    if not prompt:
        return jsonify({"error": "Prompt required"}), 400

    try:
        response = model.generate_content([prompt])

        if response.candidates:
            image_data = response.candidates[0].content.parts[0].inline_data.data

            # Return image directly
            return send_file(
                io.BytesIO(image_data),
                mimetype='image/png',
                as_attachment=True,
                download_name='generated.png'
            )
        else:
            return jsonify({"error": "No image generated"}), 500

    except Exception as e:
        return jsonify({"error": str(e)}), 500

if __name__ == '__main__':
    app.run(debug=True, port=5000)

Test it:

curl -X POST http://localhost:5000/generate \
  -H "Content-Type: application/json" \
  -d '{"prompt": "A serene mountain landscape at sunrise"}' \
  --output generated.png

Conclusion

Nano Banana Pro (Gemini 3 Pro Image) is a powerful addition to the developer's AI toolkit. With high-resolution output, text rendering, Google Search grounding, and professional controls, it opens new possibilities for dynamic image generation in applications.

Key Takeaways:

  • ✅ Easy API integration (Python, JavaScript, and more)
  • ✅ High-quality image generation (up to 4K)
  • ✅ Unique "Deep Thinking" reasoning layer
  • ✅ Google Search grounding for fact-based images
  • ✅ Image editing capabilities
  • ✅ Professional controls for developers

Start experimenting with Nano Banana Pro today and unlock creative possibilities in your applications!

Sources & Further Reading

This guide was based on official documentation and current 2025 features:


Explore more AI coding and development tools in our comprehensive directory to enhance your development workflow.

Frequently Asked Questions

How do I get started with Nano Banana Pro (Gemini 3 Pro Image) for Developers in 2025?
Complete developer guide to integrating Google's Nano Banana Pro (Gemini 3 Pro Image) API into your applications. Learn setup, API calls, and best practices.

Explore More AI Coding Tools

Browse our comprehensive directory of AI-powered development tools, IDEs, and coding assistants.

Browse All Tools