Loading...
Loading...
Generate and edit high-quality images using Google's Nano Banana Pro (Gemini 3 Pro Image) AI model. Use this skill when working with AI image generation or editing tasks including (1) Creating images from text prompts with professional quality, (2) Editing existing images with natural language instructions, (3) Multi-turn iterative image refinement, (4) Product photography and marketing visuals, (5) Creating infographics and diagrams with text, (6) Photorealistic and artistic image generation, (7) Batch image generation workflows, (8) Testing and troubleshooting Gemini image generation API. Supports up to 4K resolution, multiple aspect ratios, reference images, and advanced prompting techniques for cinema-quality results.
npx skill4agent add tdimino/claude-code-minoan nano-banana-proexport GEMINI_API_KEY="your-api-key-here"python scripts/test_connection.py --api-key YOUR_KEYexport GEMINI_API_KEY="your-api-key-here"
python scripts/test_connection.pypython scripts/generate_image.py "A futuristic cityscape at sunset, neon lights, cyberpunk style"python scripts/generate_image.py "Portrait of a cat" \
--aspect-ratio 9:16 \
--temperature 0.7 \
--output ./my_images \
--filename cat_portraitpython scripts/edit_image.py "Make the sky more dramatic with storm clouds" input.jpgpython scripts/edit_image.py "Change car color to red" photo.png \
--aspect-ratio 16:9 \
--output ./edited \
--filename red_carreferences/prompting-guide.md# High-quality product photography
python scripts/generate_image.py \
"High-end product photography of luxury watch on black marble, dramatic single key light from top-left, reflective surface, macro lens, f/5.6, commercial quality, 4K" \
--aspect-ratio 1:1 \
--temperature 0.5python scripts/edit_image.py \
"Add flying birds in the upper right sky" \
landscape.jpg \
--output ./edited# Edit 1: Change time of day
python scripts/edit_image.py "Convert to sunset lighting" day_scene.jpg \
--output ./step1 --filename sunset
# Edit 2: Add elements using output from step 1
python scripts/edit_image.py "Add warm street lamps glowing" ./step1/sunset_image_0_0.jpg \
--output ./step2 --filename with_lamps
# Edit 3: Fine-tune atmosphere
python scripts/edit_image.py "Make the sky more orange and dramatic" ./step2/with_lamps_image_0_0.jpg \
--output ./final --filename final#!/bin/bash
# batch_generate.sh
PROMPTS=(
"Modern office workspace, minimalist design"
"Cozy coffee shop interior, warm lighting"
"Professional meeting room, corporate aesthetic"
)
for i in "${!PROMPTS[@]}"; do
python scripts/generate_image.py "${PROMPTS[$i]}" \
--output ./batch_output \
--filename "scene_$i" \
--aspect-ratio 16:9
echo "Generated image $((i+1))/${#PROMPTS[@]}"
sleep 2 # Rate limiting
donefrom generate_image import NanoBananaProClient
from pathlib import Path
import base64
client = NanoBananaProClient(api_key="YOUR_KEY")
# Read reference images
ref_images = []
for img_path in ["ref1.jpg", "ref2.jpg", "ref3.jpg"]:
with open(img_path, "rb") as f:
img_data = base64.b64encode(f.read()).decode()
ref_images.append({
"inlineData": {
"mimeType": "image/jpeg",
"data": img_data
}
})
# Generate with references
# (Requires direct API call with multiple inlineData parts)[Subject] + [Style/Medium] + [Lighting Details] + [Camera/Composition] + [Quality Modifiers]"Portrait of elderly craftsman | Documentary photography style | Soft window light from left | 85mm lens, f/2.8, shallow DOF | Professional editorial quality, sharp focus on eyes"cinematic-style.mdreferences/prompting-guide.mdprompt--api-keyGEMINI_API_KEY--aspect-ratio--temperature--output--filename--verbose# Quick generation
python scripts/generate_image.py "red sports car"
# High-quality consistent output
python scripts/generate_image.py "professional headshot" \
--temperature 0.4 --aspect-ratio 3:4
# Creative exploration
python scripts/generate_image.py "abstract art" --temperature 0.9
# Debug mode
python scripts/generate_image.py "test prompt" --verbosepromptimage--api-keyGEMINI_API_KEY--aspect-ratio--temperature--output--filename--verbose# Localized changes
python scripts/edit_image.py "Make the car red" photo.jpg
# Atmospheric changes
python scripts/edit_image.py "Convert to night scene" day.jpg
# Add elements
python scripts/edit_image.py "Add mountains in background" landscape.jpg
# Remove elements
python scripts/edit_image.py "Remove person from left side" group.jpg
# Style transforms
python scripts/edit_image.py "Apply vintage film look" modern.jpg--api-key--json# Interactive test
python scripts/test_connection.py --api-key YOUR_KEY
# Automated testing
python scripts/test_connection.py --json | jq '.success'promptreferences--api-keyGEMINI_API_KEY--aspect-ratio--resolution--output--filename--verbose# Generate avatar matching reference style
python scripts/generate_with_references.py \
"Portrait of elderly craftsman in same artistic style as references" \
ref1.png ref2.jpg ref3.png \
--output ./output \
--filename craftsman
# Character consistency across images
python scripts/generate_with_references.py \
"Same character in a coffee shop scene" \
character_ref1.png character_ref2.png \
--aspect-ratio 16:9 \
--resolution 2K# 1. Quick iteration at 1K (implied by default, fastest)
python scripts/generate_image.py "concept art spaceship" \
--filename concept_draft
# 2. Review output, refine prompt
# 3. Generate final at higher quality with refined prompt
python scripts/generate_image.py "detailed concept art of sleek sci-fi spaceship, studio lighting, 4K quality, sharp details" \
--temperature 0.5 \
--filename concept_final# Verify key format and test
python scripts/test_connection.py --api-key YOUR_KEYsleep 2references/troubleshooting.mdgemini-3-pro-image-previewreferences/troubleshooting.mdreferences/api-reference.mdfrom scripts.generate_image import NanoBananaProClient
# Initialize client
client = NanoBananaProClient(api_key="YOUR_KEY")
# Generate image
response = client.generate_image(
prompt="Professional product photo",
aspect_ratio="1:1",
temperature=0.6
)
# Save results
from pathlib import Path
saved = client.save_images_from_response(
response,
output_dir=Path("./output"),
base_filename="product"
)
print(f"Saved to: {saved}")#!/bin/bash
# Simple workflow automation
export GEMINI_API_KEY="your-key"
# Generate multiple variations
for style in "modern" "vintage" "minimal"; do
python scripts/generate_image.py \
"$style office interior" \
--filename "office_${style}" \
--output ./variations
sleep 2
done
echo "Generated ${#styles[@]} variations"import time
def generate_with_retry(prompt, max_retries=3):
for attempt in range(max_retries):
try:
response = client.generate_image(prompt)
return response
except Exception as e:
if "429" in str(e): # Rate limited
wait = 2 ** attempt # Exponential backoff
print(f"Rate limited, waiting {wait}s...")
time.sleep(wait)
else:
raise
raise Exception("Max retries exceeded")# Generate hero image
python scripts/generate_image.py \
"Dynamic marketing hero image for tech startup, modern professional team collaborating, bright office space, cinematic color grading, 16:9" \
--temperature 0.6 \
--output ./campaign \
--filename hero
# Generate social media variant
python scripts/edit_image.py \
"Crop to square focusing on center, increase contrast" \
./campaign/hero_image_0_0.jpg \
--aspect-ratio 1:1 \
--output ./campaign \
--filename social# Blog header
python scripts/generate_image.py \
"Blog header for article about sustainable architecture, modern green building with vertical gardens, clear sky, professional editorial photography, 16:9" \
--filename blog_header
# Thumbnail for video
python scripts/generate_image.py \
"YouTube thumbnail style, bold composition about productivity tips, vibrant colors, text space on left third, eye-catching" \
--aspect-ratio 16:9 \
--filename thumbnail# Product shot
python scripts/generate_image.py \
"High-end product photography of minimalist desk lamp on marble surface, soft studio lighting from right, black background, commercial quality" \
--aspect-ratio 1:1 \
--temperature 0.4 \
--filename product_main
# Lifestyle context
python scripts/edit_image.py \
"Place in modern home office setting with laptop and plants" \
product_main_image_0_0.jpg \
--filename product_lifestylereferences/prompting-guide.mdreferences/api-reference.mdreferences/troubleshooting.mdassets/example-prompts.mdreferences/aldea-avatars.md# Store in environment
export GEMINI_API_KEY="AIzaSy..."
# Or in .env file (add to .gitignore!)
echo "GEMINI_API_KEY=AIzaSy..." >> .envassets/example-prompts.md--verbose