nano-banana-imagegen
Generate and edit images using Google's Nano Banana (Gemini Image API). Use when the user wants to create AI-generated images, edit existing images, create infographics, generate product mockups, design social media graphics, or perform any image generation/manipulation task. Requires GEMINI_API_KEY environment variable.
When & Why to Use This Skill
This Claude skill integrates Google's Gemini Image API (Nano Banana) to enable seamless AI image generation and editing directly within your workflow. It allows users to create high-quality visuals, infographics, and product mockups, or modify existing images with simple text prompts, significantly streamlining creative design and content production processes.
Use Cases
- 1. Marketing and Social Media: Quickly generate eye-catching graphics, banners, and promotional visuals tailored for various social platforms to increase engagement.
- 2. Professional Presentations: Create detailed infographics and complex visual data representations using the Nano Banana Pro model for superior text rendering and quality.
- 3. E-commerce and Branding: Develop rapid product mockups and conceptual brand assets to visualize ideas and speed up the design iteration cycle.
- 4. AI-Powered Image Editing: Perform sophisticated manipulations on existing photos, such as removing backgrounds, changing environments, or adjusting styles using natural language.
| name | nano-banana-imagegen |
|---|---|
| description | Generate and edit images using Google's Nano Banana (Gemini Image API). Use when the user wants to create AI-generated images, edit existing images, create infographics, generate product mockups, design social media graphics, or perform any image generation/manipulation task. Requires GEMINI_API_KEY environment variable. |
Nano Banana Image Generation
Generate and edit images using Google's Gemini Image models (Nano Banana and Nano Banana Pro).
Prerequisites
API Key: Set the
GEMINI_API_KEYenvironment variable- Get key from: https://aistudio.google.com/apikey
uv: The script uses inline dependencies with uv (no manual install needed)
Quick Start
Using the Script
# Generate an image
uv run scripts/generate_image.py "A futuristic city at sunset" -o city.png
# Edit an existing image
uv run scripts/generate_image.py "Remove the background" -i photo.jpg -o edited.png
# Use Nano Banana Pro for higher quality
uv run scripts/generate_image.py "Create a detailed infographic" -m pro -o infographic.png
Direct Python Usage (with uv)
uv run --with google-genai python -c '
from google import genai
import os
client = genai.Client(api_key=os.environ["GEMINI_API_KEY"])
response = client.models.generate_content(
model="gemini-2.5-flash-image",
contents=["Create an image of a cat wearing a space helmet"]
)
for part in response.candidates[0].content.parts:
if part.inline_data:
with open("output.png", "wb") as f:
f.write(part.inline_data.data)
print("Saved to output.png")
'
Model Selection
| Model | Use Case |
|---|---|
gemini-2.5-flash-image (Nano Banana) |
Fast generation, iterations, high volume |
gemini-3-pro-image-preview (Nano Banana Pro) |
Professional quality, text rendering, complex prompts |
Common Tasks
Image Generation
uv run scripts/generate_image.py "A serene Japanese garden with cherry blossoms" -o garden.png
Image Editing
uv run scripts/generate_image.py "Change the background to a beach sunset" -i input.jpg -o edited.png
Infographics (use Pro model)
uv run scripts/generate_image.py "Create an infographic about renewable energy" -m pro -o infographic.png
Resources
- Script:
scripts/generate_image.py- CLI tool with inline uv dependencies - API Reference: See
references/api_reference.mdfor detailed SDK usage - Prompting Guide: See
references/prompting_guide.mdfor effective prompts
Pricing
~$0.039 per image for Nano Banana (1290 tokens per image at $30/1M tokens)