Nano Banana PRO Image Generation
Generate professional AI images using Google's Nano Banana models via the Gemini API.
Prerequisites
- API key must be set as
GEMINI_API_KEY environment variable
- Uses curl for all API calls (no SDK required)
Model Selection
| Model |
Identifier |
Best For |
| Nano Banana PRO |
gemini-3-pro-image-preview |
Professional assets, text rendering, infographics, 4K output, complex multi-turn editing |
| Nano Banana |
gemini-2.5-flash-image |
Fast generation, simple edits, lower cost |
Default to PRO for quality work. Use Flash for rapid iterations or simple tasks.
CRITICAL: Prompt Engineering First
BEFORE calling the API, always craft an effective prompt. Read references/prompting-guide.md for comprehensive prompting strategies. Key principles:
The Golden Rules
- Describe scenes, don't list keywords - Write narrative descriptions, not tag soup
- Use natural language - Full sentences with proper grammar
- Be specific - Define subject, setting, lighting, mood, materials
- Provide context - The "why" helps the model make better artistic decisions
- Edit, don't re-roll - If 80% correct, ask for specific changes
The ICS Framework (Quick Reference)
For any image, specify:
- Image type: What kind of visual (photo, infographic, logo, sticker, etc.)
- Content: Specific elements, data, or information to include
- Style: Visual style, color palette, artistic approach
API Reference
Text-to-Image Generation
curl -s -X POST \
"https://generativelanguage.googleapis.com/v1beta/models/gemini-3-pro-image-preview:generateContent" \
-H "x-goog-api-key: $GEMINI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"contents": [{
"parts": [{"text": "YOUR_PROMPT_HERE"}]
}],
"generationConfig": {
"responseModalities": ["TEXT", "IMAGE"],
"imageConfig": {
"aspectRatio": "16:9",
"imageSize": "2K"
}
}
}'
Image Editing (with input image)
curl -s -X POST \
"https://generativelanguage.googleapis.com/v1beta/models/gemini-3-pro-image-preview:generateContent" \
-H "x-goog-api-key: $GEMINI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"contents": [{
"parts": [
{"text": "YOUR_EDIT_INSTRUCTION"},
{"inline_data": {"mime_type": "image/png", "data": "BASE64_IMAGE_DATA"}}
]
}],
"generationConfig": {
"responseModalities": ["TEXT", "IMAGE"]
}
}'
Configuration Options
| Parameter |
Values |
Notes |
aspectRatio |
1:1, 2:3, 3:2, 3:4, 4:3, 4:5, 5:4, 9:16, 16:9, 21:9 |
Match use case |
imageSize |
1K, 2K, 4K |
Use uppercase K; PRO model only for 4K |
Google Search Grounding (Real-time Data)
Add "tools": [{"google_search": {}}] to generate images based on current information:
curl -s -X POST \
"https://generativelanguage.googleapis.com/v1beta/models/gemini-3-pro-image-preview:generateContent" \
-H "x-goog-api-key: $GEMINI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"contents": [{"parts": [{"text": "Create an infographic of current tech stock prices"}]}],
"tools": [{"google_search": {}}],
"generationConfig": {
"responseModalities": ["TEXT", "IMAGE"],
"imageConfig": {"aspectRatio": "16:9"}
}
}'
Workflow
Step 1: Craft the Prompt
Use the ICS framework and prompting guide. Examples:
Photorealistic:
A photorealistic close-up portrait of an elderly Japanese ceramicist with deep wrinkles and a warm smile, inspecting a tea bowl. Soft golden hour light from a window. 85mm lens, shallow depth of field. Serene mood.
Infographic:
Create a clean, modern infographic explaining photosynthesis as a recipe. Show "ingredients" (sunlight, water, CO2) and "finished dish" (energy). Style like a colorful kids' cookbook page.
Product Shot:
High-resolution studio photograph of a matte black ceramic coffee mug on polished concrete. Three-point softbox lighting, 45-degree angle, sharp focus on rising steam. Square format.
Step 2: Generate Image
Use scripts/generate-image.sh or call API directly:
./scripts/generate-image.sh "Your prompt here" output.png --ratio 16:9 --size 2K
Step 3: Process Response
The API returns base64-encoded image data. Extract and decode:
# Response contains: {"candidates":[{"content":{"parts":[{"inlineData":{"mimeType":"image/png","data":"BASE64..."}}]}}]}
# Extract with jq and decode:
cat response.json | jq -r '.candidates[0].content.parts[] | select(.inlineData) | .inlineData.data' | base64 -d > image.png
Common Use Cases
Landing Pages & Ads
- Use 16:9 or 21:9 for hero images
- Specify brand colors, modern/minimal style
- Include text requirements in prompt
Logos & Icons
- Use 1:1 aspect ratio
- Request "minimalist", "clean lines", "vector-style"
- Specify color scheme explicitly
Product Photography
- Describe lighting setup (softbox, natural, studio)
- Mention surface/background materials
- Include camera angle and lens type
Infographics
- Define data to visualize
- Specify style (corporate, playful, technical)
- Request clear text and labeled sections
Stickers & Illustrations
- Request "bold outlines", "kawaii", "cel-shading"
- Specify "white background" or "transparent background"
- Define color palette
Character Consistency (Multiple Images)
- PRO supports up to 14 reference images
- Explicitly state: "Keep facial features exactly the same as Image 1"
- Describe expression/pose changes while maintaining identity
Scripts
See scripts/generate-image.sh for a ready-to-use generation script.
Detailed Prompting Guide
For advanced techniques including:
- Photorealistic scene templates
- Text rendering best practices
- Sequential art and storyboarding
- Dimensional translation (2D↔3D)
- Search grounding for real-time data
Read references/prompting-guide.md.
1---2name: nano-banana3description: "AI image generation using Nano Banana PRO (Gemini 3 Pro Image) and Nano Banana (Gemini 2.5 Flash Image). Use this skill when: (1) Generating images from text prompts, (2) Editing existing images, (3) Creating professional visual assets like infographics, logos, product shots, stickers, (4) Working with character consistency across multiple images, (5) Creating images with accurate text rendering, (6) Any task requiring AI-generated visuals. Triggers on: 'generate image', 'create image', 'make a picture', 'design a logo', 'create infographic', 'AI image', 'nano banana', or any image generation request."4metadata:5 source: https://skillmd.com/skills/diegosouzapw/nano-banana6---78# Nano Banana PRO Image Generation910Generate professional AI images using Google's Nano Banana models via the Gemini API.1112## Prerequisites1314- API key must be set as `GEMINI_API_KEY` environment variable15- Uses curl for all API calls (no SDK required)1617## Model Selection1819| Model | Identifier | Best For |20|-------|------------|----------|21| **Nano Banana PRO** | `gemini-3-pro-image-preview` | Professional assets, text rendering, infographics, 4K output, complex multi-turn editing |22| **Nano Banana** | `gemini-2.5-flash-image` | Fast generation, simple edits, lower cost |2324**Default to PRO** for quality work. Use Flash for rapid iterations or simple tasks.2526## CRITICAL: Prompt Engineering First2728**BEFORE calling the API, always craft an effective prompt.** Read [`references/prompting-guide.md`](references/prompting-guide.md) for comprehensive prompting strategies. Key principles:2930### The Golden Rules31321. **Describe scenes, don't list keywords** - Write narrative descriptions, not tag soup332. **Use natural language** - Full sentences with proper grammar343. **Be specific** - Define subject, setting, lighting, mood, materials354. **Provide context** - The "why" helps the model make better artistic decisions365. **Edit, don't re-roll** - If 80% correct, ask for specific changes3738### The ICS Framework (Quick Reference)3940For any image, specify:41- **I**mage type: What kind of visual (photo, infographic, logo, sticker, etc.)42- **C**ontent: Specific elements, data, or information to include43- **S**tyle: Visual style, color palette, artistic approach4445## API Reference4647### Text-to-Image Generation4849```bash50curl -s -X POST \51 "https://generativelanguage.googleapis.com/v1beta/models/gemini-3-pro-image-preview:generateContent" \52 -H "x-goog-api-key: $GEMINI_API_KEY" \53 -H "Content-Type: application/json" \54 -d '{55 "contents": [{56 "parts": [{"text": "YOUR_PROMPT_HERE"}]57 }],58 "generationConfig": {59 "responseModalities": ["TEXT", "IMAGE"],60 "imageConfig": {61 "aspectRatio": "16:9",62 "imageSize": "2K"63 }64 }65 }'66```6768### Image Editing (with input image)6970```bash71curl -s -X POST \72 "https://generativelanguage.googleapis.com/v1beta/models/gemini-3-pro-image-preview:generateContent" \73 -H "x-goog-api-key: $GEMINI_API_KEY" \74 -H "Content-Type: application/json" \75 -d '{76 "contents": [{77 "parts": [78 {"text": "YOUR_EDIT_INSTRUCTION"},79 {"inline_data": {"mime_type": "image/png", "data": "BASE64_IMAGE_DATA"}}80 ]81 }],82 "generationConfig": {83 "responseModalities": ["TEXT", "IMAGE"]84 }85 }'86```8788### Configuration Options8990| Parameter | Values | Notes |91|-----------|--------|-------|92| `aspectRatio` | `1:1`, `2:3`, `3:2`, `3:4`, `4:3`, `4:5`, `5:4`, `9:16`, `16:9`, `21:9` | Match use case |93| `imageSize` | `1K`, `2K`, `4K` | Use uppercase K; PRO model only for 4K |9495### Google Search Grounding (Real-time Data)9697Add `"tools": [{"google_search": {}}]` to generate images based on current information:9899```bash100curl -s -X POST \101 "https://generativelanguage.googleapis.com/v1beta/models/gemini-3-pro-image-preview:generateContent" \102 -H "x-goog-api-key: $GEMINI_API_KEY" \103 -H "Content-Type: application/json" \104 -d '{105 "contents": [{"parts": [{"text": "Create an infographic of current tech stock prices"}]}],106 "tools": [{"google_search": {}}],107 "generationConfig": {108 "responseModalities": ["TEXT", "IMAGE"],109 "imageConfig": {"aspectRatio": "16:9"}110 }111 }'112```113114## Workflow115116### Step 1: Craft the Prompt117118Use the ICS framework and prompting guide. Examples:119120**Photorealistic:**121```122A photorealistic close-up portrait of an elderly Japanese ceramicist with deep wrinkles and a warm smile, inspecting a tea bowl. Soft golden hour light from a window. 85mm lens, shallow depth of field. Serene mood.123```124125**Infographic:**126```127Create a clean, modern infographic explaining photosynthesis as a recipe. Show "ingredients" (sunlight, water, CO2) and "finished dish" (energy). Style like a colorful kids' cookbook page.128```129130**Product Shot:**131```132High-resolution studio photograph of a matte black ceramic coffee mug on polished concrete. Three-point softbox lighting, 45-degree angle, sharp focus on rising steam. Square format.133```134135### Step 2: Generate Image136137Use `scripts/generate-image.sh` or call API directly:138139```bash140./scripts/generate-image.sh "Your prompt here" output.png --ratio 16:9 --size 2K141```142143### Step 3: Process Response144145The API returns base64-encoded image data. Extract and decode:146147```bash148# Response contains: {"candidates":[{"content":{"parts":[{"inlineData":{"mimeType":"image/png","data":"BASE64..."}}]}}]}149# Extract with jq and decode:150cat response.json | jq -r '.candidates[0].content.parts[] | select(.inlineData) | .inlineData.data' | base64 -d > image.png151```152153## Common Use Cases154155### Landing Pages & Ads156- Use 16:9 or 21:9 for hero images157- Specify brand colors, modern/minimal style158- Include text requirements in prompt159160### Logos & Icons161- Use 1:1 aspect ratio162- Request "minimalist", "clean lines", "vector-style"163- Specify color scheme explicitly164165### Product Photography166- Describe lighting setup (softbox, natural, studio)167- Mention surface/background materials168- Include camera angle and lens type169170### Infographics171- Define data to visualize172- Specify style (corporate, playful, technical)173- Request clear text and labeled sections174175### Stickers & Illustrations176- Request "bold outlines", "kawaii", "cel-shading"177- Specify "white background" or "transparent background"178- Define color palette179180### Character Consistency (Multiple Images)181- PRO supports up to 14 reference images182- Explicitly state: "Keep facial features exactly the same as Image 1"183- Describe expression/pose changes while maintaining identity184185## Scripts186187See [`scripts/generate-image.sh`](scripts/generate-image.sh) for a ready-to-use generation script.188189## Detailed Prompting Guide190191For advanced techniques including:192- Photorealistic scene templates193- Text rendering best practices 194- Sequential art and storyboarding195- Dimensional translation (2D↔3D)196- Search grounding for real-time data197198Read [`references/prompting-guide.md`](references/prompting-guide.md).