
Nanobanana
- 2.6k installs
- 1.2k repo stars
- Updated July 27, 2026
- resciencelab/opc-skills
nanobanana is an OPC skill for Gemini 3 Pro Image generation and editing with aspect ratios and 2K or 4K output.
About
Nano Banana generates and edits images using Google Gemini 3 Pro Image model gemini-3-pro-image-preview with text-to-image, image editing, aspect ratio control, and 2K or 4K resolution options. Prerequisites are GEMINI_API_KEY from Google AI Studio and Python 3.10 plus google-genai and pillow packages. The generate.py script accepts prompts with output path, optional input image for edits, ratio flags like 16:9 or 21:9, size 2K or 4K, and optional Google Search grounding for factual subjects. batch_generate.py produces sequential named outputs with configurable count, prefix, delay, and directory. Python API exposes generate_image and edit_image functions for programmatic use. Best practices stress detailed prompts with subject, style, lighting, composition, and color palette, plus 3 to 5 second delays between batch runs to respect rate limits. Troubleshooting covers missing API keys, safety filter empty responses, and quota exhaustion. Reference prompts.md and examples directory supplement category-specific prompt patterns.
- Gemini 3 Pro Image text-to-image and edit flows.
- Aspect ratios from 1:1 through 21:9 cinematic widescreen.
- 2K and 4K resolution tiers with search grounding option.
- batch_generate.py for sequential multi-image runs.
- Python API with generate_image and edit_image helpers.
Nanobanana by the numbers
- 2,582 all-time installs (skills.sh)
- +52 installs in the week ending Jul 28, 2026 (Skillselion tracking)
- Ranked #140 of 1,340 Generative Media skills by installs in the Skillselion catalog
- Security screen: HIGH risk (skills.sh audit)
- Data as of Jul 28, 2026 (Skillselion catalog sync)
nanobanana capabilities & compatibility
- Capabilities
- cli text to image generation · image editing from input file · aspect ratio and 2k or 4k sizing · batch sequential image production · google search grounding toggle · python generate_image api
- Works with
- openai
- Use cases
- image generation · marketing
- Pricing
- Bring your own API key
What nanobanana says it does
Generate and edit images using Google's Gemini 3 Pro Image model
pip install google-genai pillow
npx skills add https://github.com/resciencelab/opc-skills --skill nanobananaAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 2.6k |
|---|---|
| repo stars | ★ 1.2k |
| Security audit | 2 / 3 scanners passed |
| Last updated | July 27, 2026 |
| Repository | resciencelab/opc-skills ↗ |
How do I generate or edit images with Gemini image models from CLI or Python scripts?
Generate and edit images with Google Gemini 3 Pro Image via Python scripts supporting aspect ratios and 2K or 4K output.
Who is it for?
Users creating marketing visuals, product shots, or iterative image batches with Gemini image models.
Skip if: Skip for video generation, SVG vector art, or image hosting and CDN delivery setup.
When should I use this skill?
User wants AI image generation, Gemini image editing, or batch image creation with Nano Banana.
What you get
Saved PNG or JPG output from a prompt, optional edit pass, chosen ratio, and resolution tier.
- 2K/4K generated images
- Edited image files from prompts
By the numbers
- Published as opc-skills version 1.0.0 with MIT license
- Supports 2K and 4K image output resolutions
Files
Nano Banana - AI Image Generation
Generate and edit images using Google's Gemini 3 Pro Image model (gemini-3-pro-image-preview, nicknamed "Nano Banana Pro" 🍌).
Prerequisites
Required:
GEMINI_API_KEY- Get from Google AI Studio- Python 3.10+ with
google-genaipackage
Install dependencies:
pip install google-genai pillowQuick Start
Generate an image:
python3 <skill_dir>/scripts/generate.py "a cute robot mascot, pixel art style" -o robot.pngEdit an existing image:
python3 <skill_dir>/scripts/generate.py "make the background blue" -i input.jpg -o output.pngGenerate with specific aspect ratio:
python3 <skill_dir>/scripts/generate.py "cinematic landscape" --ratio 21:9 -o landscape.pngGenerate high-resolution 4K image:
python3 <skill_dir>/scripts/generate.py "professional product photo" --size 4K -o product.pngScript Reference
scripts/generate.py
Main image generation script.
Usage: generate.py [OPTIONS] PROMPT
Arguments:
PROMPT Text prompt for image generation
Options:
-o, --output PATH Output file path (default: auto-generated)
-i, --input PATH Input image for editing (optional)
-r, --ratio RATIO Aspect ratio (1:1, 16:9, 9:16, 21:9, etc.)
-s, --size SIZE Image size: 2K or 4K (default: standard)
--search Enable Google Search grounding for accuracy
-v, --verbose Show detailed outputSupported aspect ratios:
1:1- Square (default)2:3,3:2- Portrait/Landscape3:4,4:3- Standard4:5,5:4- Photo9:16,16:9- Widescreen21:9- Ultra-wide/Cinematic
scripts/batch_generate.py
Generate multiple images with sequential naming.
Usage: batch_generate.py [OPTIONS] PROMPT
Arguments:
PROMPT Text prompt for image generation
Options:
-n, --count N Number of images to generate (default: 10)
-d, --dir PATH Output directory
-p, --prefix STR Filename prefix (default: "image")
-r, --ratio RATIO Aspect ratio
-s, --size SIZE Image size (2K/4K)
--delay SECONDS Delay between generations (default: 3)Example:
python3 <skill_dir>/scripts/batch_generate.py "pixel art logo" -n 20 -d ./logos -p logoPython API
You can also use the module directly:
from generate import generate_image, edit_image
# Generate image
result = generate_image(
prompt="a futuristic city at night",
output_path="city.png",
aspect_ratio="16:9",
image_size="4K"
)
# Edit existing image
result = edit_image(
prompt="add flying cars to the sky",
input_path="city.png",
output_path="city_edited.png"
)Environment Variables
| Variable | Description | Default |
|---|---|---|
GEMINI_API_KEY | Google Gemini API key | Required |
IMAGE_OUTPUT_DIR | Default output directory | ./nanobanana-images |
Features
Text-to-Image Generation
Create images from text descriptions. The model excels at:
- Photorealistic images
- Artistic styles (pixel art, illustration, etc.)
- Product photography
- Landscapes and scenes
Image Editing
Transform existing images with natural language:
- Style transfer
- Object addition/removal
- Background changes
- Color adjustments
High-Resolution Output
- Standard: Fast generation, good quality
- 2K: Enhanced detail (2048px)
- 4K: Maximum quality (3840px), best for text rendering
Google Search Grounding
Enable --search for factually accurate images involving:
- Real people, places, landmarks
- Current events
- Specific products or brands
Best Practices
Prompt Writing
Good prompts include:
- Subject description
- Style/aesthetic
- Lighting and mood
- Composition details
- Color palette
Example:
"A cozy coffee shop interior, warm lighting, vintage aesthetic,
wooden furniture, plants on shelves, morning sunlight through windows,
soft focus background, 35mm film photography style"Batch Generation Tips
1. Generate 10-20 variations to explore options 2. Use consistent prompts for style coherence 3. Add 3-5 second delays to avoid rate limits 4. Review results and iterate on best candidates
Rate Limits
- Gemini API has usage quotas
- Add delays between batch generations
- Check your quota at Google AI Studio
Troubleshooting
"API key not found"
- Set
GEMINI_API_KEYenvironment variable - Or pass via
--api-keyoption
"No image in response"
- Prompt may have triggered safety filters
- Try rephrasing to avoid sensitive content
"Rate limit exceeded"
- Wait a few seconds and retry
- Reduce batch size or add longer delays
References
- references/prompts.md - Prompt examples by category
- examples/ - Example usage scripts
{
"name": "nanobanana",
"version": "1.0.0",
"description": "Generate and edit images using Google Gemini 3 Pro Image (Nano Banana Pro). Supports text-to-image, image editing, aspect ratios, and 2K/4K output.",
"author": {
"name": "ReScienceLab"
},
"homepage": "https://github.com/ReScienceLab/opc-skills/tree/main/skills/nanobanana",
"repository": "https://github.com/ReScienceLab/opc-skills",
"license": "MIT",
"keywords": [
"generate image",
"create image",
"nano banana",
"nanobanana",
"gemini image",
"AI image"
],
"skills": [
"./SKILL.md"
],
"commands": [
"./scripts/"
]
}Nano Banana Prompt Reference
Prompt Structure
A good prompt typically includes: 1. Subject - What to generate 2. Style - Artistic style or aesthetic 3. Details - Lighting, colors, composition 4. Quality - Resolution hints, professional quality
Categories
Pixel Art / 8-bit
Pixel art {subject}, 8-bit retro style, limited color palette,
crisp pixels, nostalgic video game aestheticExamples:
Pixel art robot mascot, 8-bit style, blue and orange colors,
friendly expression, transparent background
Pixel art landscape, retro video game style, sunset colors,
16-bit era aesthetic, side-scrolling game background
Pixel art food icons, 8-bit style, bright colors,
game UI elements, clean pixel edgesPhotorealistic
Professional photograph of {subject}, {lighting} lighting,
{lens} lens, high resolution, sharp focus, {mood}Examples:
Professional product photo of wireless headphones on marble surface,
soft studio lighting, 85mm lens, high resolution, minimalist background
Portrait photograph of elderly craftsman in workshop,
natural window lighting, 50mm lens, shallow depth of field,
warm tones, documentary style
Aerial photograph of coastal city at golden hour,
drone perspective, dramatic lighting, high dynamic rangeDigital Art / Illustration
Digital illustration of {subject}, {style} style,
{colors} color palette, {mood} atmosphereExamples:
Digital illustration of enchanted forest, fantasy art style,
purple and teal color palette, mystical atmosphere,
detailed foliage, magical creatures
Character concept art, cyberpunk style, neon lighting,
futuristic armor design, dynamic pose, professional quality
Children's book illustration, whimsical style, pastel colors,
friendly animals in meadow, soft edges, storybook qualityMinimalist / Flat Design
Minimalist {subject}, flat design, {colors},
clean lines, simple shapes, modern aestheticExamples:
Minimalist logo design, geometric mountain shape,
blue gradient, flat design, vector style, clean edges
Minimalist app icon, flat design, single color,
simple shape, rounded corners, iOS style
Minimalist infographic elements, flat icons,
corporate blue palette, clean vector style3D / Isometric
3D render of {subject}, isometric view, {style},
soft shadows, {colors}, clean backgroundExamples:
3D isometric office workspace, low poly style,
pastel colors, soft shadows, cute aesthetic
3D render of floating island, isometric perspective,
fantasy environment, vibrant colors, game asset style
Isometric city block, architectural visualization,
modern buildings, clean lines, professional renderAbstract / Artistic
Abstract {subject}, {style} style, {colors},
{texture}, artistic compositionExamples:
Abstract fluid art, vibrant colors, marble texture,
flowing shapes, high contrast, contemporary style
Abstract geometric pattern, bauhaus style,
primary colors, sharp edges, modernist aesthetic
Abstract landscape, impressionist style,
soft brushstrokes, dreamy atmosphere, oil painting textureAspect Ratio Guidelines
| Ratio | Use Case | Example Prompt Suffix |
|---|---|---|
| 1:1 | Icons, avatars, social posts | "square format, centered composition" |
| 16:9 | Banners, YouTube thumbnails | "wide format, horizontal composition" |
| 9:16 | Phone wallpapers, stories | "vertical format, portrait orientation" |
| 21:9 | Cinematic, ultra-wide | "cinematic aspect ratio, panoramic view" |
| 4:3 | Presentations, traditional | "standard format, classic composition" |
| 2:3 | Portrait photos | "portrait orientation, full body framing" |
Quality Modifiers
Resolution hints:
- "high resolution"
- "4K quality"
- "ultra detailed"
- "sharp focus"
- "crisp details"
Professional quality:
- "professional photograph"
- "studio quality"
- "commercial grade"
- "publication ready"
- "award winning"
Style consistency:
- "consistent style"
- "cohesive aesthetic"
- "unified color palette"
- "matching visual language"
Negative Concepts
To avoid unwanted elements, describe what you want clearly:
Instead of: "no text" Use: "clean image without text, pure visual"
Instead of: "no people" Use: "empty scene, unpopulated environment"
Instead of: "not blurry" Use: "sharp focus, crisp details, high clarity"
Batch Generation Tips
When generating multiple variations:
1. Keep core prompt consistent - Same subject and style 2. Vary specific details - Colors, poses, backgrounds 3. Use numbered batches - Track which prompts work best 4. Iterate on winners - Refine prompts that produce good results
Example batch workflow:
# Round 1: Explore styles
"pixel art robot, 8-bit style, blue colors"
"pixel art robot, retro game style, warm colors"
"pixel art robot, modern pixel art, neon colors"
# Round 2: Refine best style
"pixel art robot, 8-bit style, blue and silver colors, friendly expression"
"pixel art robot, 8-bit style, blue and gold colors, heroic pose"#!/usr/bin/env python3
"""
Batch image generation using Nano Banana (Gemini 3 Pro Image).
Usage:
python batch_generate.py "pixel art logo" -n 20 -d ./logos -p logo
python batch_generate.py "product photo" -n 10 --ratio 1:1 --size 4K
python batch_generate.py "landscape" -n 20 --parallel 5 # 5 concurrent requests
"""
import argparse
import sys
import time
from concurrent.futures import ThreadPoolExecutor, as_completed
from pathlib import Path
from threading import Lock
from generate import generate_image, VALID_ASPECT_RATIOS
# Thread-safe print lock
print_lock = Lock()
def _generate_single(args_tuple):
"""Worker function for parallel generation."""
i, count, filepath, prompt, aspect_ratio, image_size, verbose = args_tuple
filename = filepath.name
result = generate_image(
prompt=prompt,
output_path=str(filepath),
aspect_ratio=aspect_ratio,
image_size=image_size,
verbose=False,
)
result["index"] = i
result["filename"] = filename
if verbose:
with print_lock:
status = "OK" if result["success"] else f"FAILED: {result['error']}"
print(f"[{i}/{count}] {filename}: {status}")
return result
def batch_generate(
prompt: str,
count: int = 10,
output_dir: str = "./nanobanana-images",
prefix: str = "image",
aspect_ratio: str = None,
image_size: str = None,
delay: float = 3.0,
parallel: int = 1,
verbose: bool = True,
) -> list[dict]:
"""
Generate multiple images with sequential naming.
Args:
prompt: Text description for image generation
count: Number of images to generate
output_dir: Directory to save images
prefix: Filename prefix
aspect_ratio: Aspect ratio (1:1, 16:9, etc.)
image_size: Resolution (2K or 4K)
delay: Seconds to wait between generations (ignored if parallel > 1)
parallel: Number of concurrent requests (default: 1, max recommended: 5)
verbose: Print progress
Returns:
List of result dicts
"""
output_path = Path(output_dir)
output_path.mkdir(parents=True, exist_ok=True)
if verbose:
print(f"Generating {count} images...")
print(f"Prompt: {prompt}")
print(f"Output: {output_dir}/{prefix}-XX.png")
if aspect_ratio:
print(f"Aspect ratio: {aspect_ratio}")
if image_size:
print(f"Size: {image_size}")
if parallel > 1:
print(f"Parallel workers: {parallel}")
print()
# Prepare tasks
tasks = []
for i in range(1, count + 1):
filename = f"{prefix}-{str(i).zfill(2)}.png"
filepath = output_path / filename
tasks.append((i, count, filepath, prompt, aspect_ratio, image_size, verbose))
results = []
if parallel > 1:
# Parallel execution
with ThreadPoolExecutor(max_workers=parallel) as executor:
futures = [executor.submit(_generate_single, task) for task in tasks]
for future in as_completed(futures):
results.append(future.result())
else:
# Sequential execution with delay
for task in tasks:
result = _generate_single(task)
results.append(result)
# Delay between requests (except for last one)
if task[0] < count and delay > 0:
time.sleep(delay)
# Sort results by index
results.sort(key=lambda x: x["index"])
success_count = sum(1 for r in results if r["success"])
if verbose:
print()
print(f"Complete: {success_count}/{count} images generated")
print(f"Saved to: {output_dir}/")
return results
def main():
parser = argparse.ArgumentParser(
description="Batch generate images using Nano Banana",
formatter_class=argparse.RawDescriptionHelpFormatter,
epilog="""
Examples:
%(prog)s "pixel art logo" -n 20 -d ./logos -p logo
%(prog)s "product photo" -n 10 --ratio 1:1 --size 4K
%(prog)s "landscape painting" -n 5 --ratio 16:9 --delay 5
"""
)
parser.add_argument("prompt", help="Text prompt for image generation")
parser.add_argument("-n", "--count", type=int, default=10,
help="Number of images to generate (default: 10)")
parser.add_argument("-d", "--dir", default="./nanobanana-images",
help="Output directory")
parser.add_argument("-p", "--prefix", default="image",
help="Filename prefix (default: image)")
parser.add_argument("-r", "--ratio", choices=VALID_ASPECT_RATIOS,
help="Aspect ratio")
parser.add_argument("-s", "--size", choices=["2K", "4K", "2k", "4k"],
help="Image size (2K or 4K)")
parser.add_argument("--delay", type=float, default=3.0,
help="Delay between generations in seconds (default: 3, ignored if --parallel > 1)")
parser.add_argument("--parallel", type=int, default=1,
help="Number of concurrent requests (default: 1, max recommended: 5)")
parser.add_argument("-q", "--quiet", action="store_true",
help="Suppress progress output")
args = parser.parse_args()
results = batch_generate(
prompt=args.prompt,
count=args.count,
output_dir=args.dir,
prefix=args.prefix,
aspect_ratio=args.ratio,
image_size=args.size.upper() if args.size else None,
delay=args.delay,
parallel=args.parallel,
verbose=not args.quiet,
)
# Exit with error if all failed
success_count = sum(1 for r in results if r["success"])
if success_count == 0:
sys.exit(1)
if __name__ == "__main__":
main()
#!/usr/bin/env python3
"""
Nano Banana - AI Image Generation using Google Gemini 3 Pro Image
Usage:
python generate.py "a cute robot" -o robot.png
python generate.py "make it blue" -i input.jpg -o output.png
python generate.py "landscape" --ratio 16:9 --size 4K -o landscape.png
"""
import argparse
import base64
import os
import sys
from datetime import datetime
from pathlib import Path
try:
from google import genai
from google.genai import types
except ImportError:
print("Error: google-genai package not installed.")
print("Install with: pip install google-genai")
sys.exit(1)
MODEL_NAME = "gemini-3-pro-image-preview"
VALID_ASPECT_RATIOS = [
"1:1", "2:3", "3:2", "3:4", "4:3",
"4:5", "5:4", "9:16", "16:9", "21:9"
]
VALID_SIZES = ["2K", "4K"]
def get_api_key() -> str:
"""Get Gemini API key from environment."""
api_key = os.environ.get("GEMINI_API_KEY")
if not api_key:
print("Error: GEMINI_API_KEY environment variable not set.")
print("Get your API key from: https://aistudio.google.com/apikey")
sys.exit(1)
return api_key
def load_image_as_base64(path: str) -> tuple[str, str]:
"""Load image file and return base64 data and mime type."""
path = Path(path)
if not path.exists():
raise FileNotFoundError(f"Image file not found: {path}")
ext = path.suffix.lower()
mime_types = {
".jpg": "image/jpeg",
".jpeg": "image/jpeg",
".png": "image/png",
".webp": "image/webp",
".gif": "image/gif",
}
mime_type = mime_types.get(ext, "image/jpeg")
with open(path, "rb") as f:
data = base64.standard_b64encode(f.read()).decode("utf-8")
return data, mime_type
def generate_output_path(output_dir: str = None) -> str:
"""Generate a unique output filename."""
if output_dir is None:
output_dir = os.environ.get("IMAGE_OUTPUT_DIR", "./nanobanana-images")
Path(output_dir).mkdir(parents=True, exist_ok=True)
timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
return str(Path(output_dir) / f"nanobanana_{timestamp}.png")
def generate_image(
prompt: str,
output_path: str = None,
input_path: str = None,
aspect_ratio: str = None,
image_size: str = None,
use_search: bool = False,
verbose: bool = False,
) -> dict:
"""
Generate or edit an image using Gemini API.
Args:
prompt: Text description or editing instruction
output_path: Where to save the generated image
input_path: Input image for editing (optional)
aspect_ratio: Aspect ratio (1:1, 16:9, etc.)
image_size: Resolution (2K or 4K)
use_search: Enable Google Search grounding
verbose: Print detailed output
Returns:
dict with 'success', 'path', 'metadata'
"""
api_key = get_api_key()
client = genai.Client(api_key=api_key)
if output_path is None:
output_path = generate_output_path()
# Ensure output directory exists
Path(output_path).parent.mkdir(parents=True, exist_ok=True)
# Build contents
contents = []
if input_path:
# Image editing mode
image_data, mime_type = load_image_as_base64(input_path)
contents.append(
types.Part.from_bytes(
data=base64.standard_b64decode(image_data),
mime_type=mime_type
)
)
if verbose:
print(f"Input image: {input_path}")
contents.append(prompt)
# Build config
generate_config = types.GenerateContentConfig(
response_modalities=["IMAGE", "TEXT"]
)
# Add image config if needed
if aspect_ratio or image_size:
image_config_dict = {}
if aspect_ratio:
if aspect_ratio not in VALID_ASPECT_RATIOS:
print(f"Warning: Invalid aspect ratio '{aspect_ratio}'. Valid options: {VALID_ASPECT_RATIOS}")
else:
image_config_dict["aspect_ratio"] = aspect_ratio
if image_size:
if image_size.upper() not in VALID_SIZES:
print(f"Warning: Invalid size '{image_size}'. Valid options: {VALID_SIZES}")
else:
image_config_dict["image_size"] = image_size.upper()
if image_config_dict:
generate_config = types.GenerateContentConfig(
response_modalities=["IMAGE", "TEXT"],
image_config=types.ImageConfig(**image_config_dict)
)
if verbose:
print(f"Model: {MODEL_NAME}")
print(f"Prompt: {prompt}")
if aspect_ratio:
print(f"Aspect ratio: {aspect_ratio}")
if image_size:
print(f"Size: {image_size}")
print("Generating...")
try:
response = client.models.generate_content(
model=MODEL_NAME,
contents=contents,
config=generate_config,
)
# Extract image from response
image_data = None
text_response = None
for part in response.candidates[0].content.parts:
if part.inline_data and part.inline_data.mime_type.startswith("image/"):
image_data = part.inline_data.data
mime_type = part.inline_data.mime_type
elif part.text:
text_response = part.text
if not image_data:
error_msg = text_response or "No image generated"
return {
"success": False,
"error": error_msg,
"path": None,
}
# Save image
with open(output_path, "wb") as f:
f.write(image_data)
if verbose:
print(f"Saved: {output_path}")
if text_response:
print(f"Model response: {text_response}")
return {
"success": True,
"path": output_path,
"metadata": {
"model": MODEL_NAME,
"prompt": prompt,
"aspect_ratio": aspect_ratio,
"image_size": image_size,
"input_image": input_path,
"timestamp": datetime.now().isoformat(),
}
}
except Exception as e:
error_msg = str(e)
if "safety" in error_msg.lower():
error_msg = "Content blocked by safety filters. Try rephrasing your prompt."
elif "quota" in error_msg.lower() or "rate" in error_msg.lower():
error_msg = "Rate limit exceeded. Wait a moment and try again."
return {
"success": False,
"error": error_msg,
"path": None,
}
def edit_image(
prompt: str,
input_path: str,
output_path: str = None,
verbose: bool = False,
) -> dict:
"""Convenience function for image editing."""
return generate_image(
prompt=prompt,
output_path=output_path,
input_path=input_path,
verbose=verbose,
)
def main():
parser = argparse.ArgumentParser(
description="Generate images using Google Gemini 3 Pro Image (Nano Banana)",
formatter_class=argparse.RawDescriptionHelpFormatter,
epilog="""
Examples:
%(prog)s "a cute robot mascot" -o robot.png
%(prog)s "make the sky purple" -i photo.jpg -o edited.png
%(prog)s "cinematic landscape" --ratio 21:9 --size 4K -o landscape.png
"""
)
parser.add_argument("prompt", help="Text prompt for image generation")
parser.add_argument("-o", "--output", help="Output file path")
parser.add_argument("-i", "--input", help="Input image for editing")
parser.add_argument("-r", "--ratio", choices=VALID_ASPECT_RATIOS,
help="Aspect ratio (default: 1:1)")
parser.add_argument("-s", "--size", choices=["2K", "4K", "2k", "4k"],
help="Image size (2K or 4K)")
parser.add_argument("--search", action="store_true",
help="Enable Google Search grounding")
parser.add_argument("-v", "--verbose", action="store_true",
help="Show detailed output")
args = parser.parse_args()
result = generate_image(
prompt=args.prompt,
output_path=args.output,
input_path=args.input,
aspect_ratio=args.ratio,
image_size=args.size.upper() if args.size else None,
use_search=args.search,
verbose=args.verbose or (args.output is None),
)
if result["success"]:
print(result["path"])
sys.exit(0)
else:
print(f"Error: {result['error']}", file=sys.stderr)
sys.exit(1)
if __name__ == "__main__":
main()
Related skills
How it compares
Pick nanobanana over logo-creator when you need general Gemini image generation or editing at 2K/4K rather than SVG logo export.
FAQ
What API key is required?
Set GEMINI_API_KEY from Google AI Studio before running generate.py.
When use --search grounding?
Enable it for factually accurate images of real people, places, landmarks, or brands.
How avoid rate limits in batches?
Use batch_generate.py with 3 to 5 second delays between generations.
Is Nanobanana safe to install?
skills.sh reports 2 of 3 security scanners passed. Review the Security Audits panel on this page before installing in production.