Google Gemini 2.5 Flash Image (Nano Banana) model for generating, editing, and creating AI-powered visual content including infographics, product photos, illustrations, and more. Use when the user asks about nanobana image generator.
Google Gemini 2.5 Flash Image (Nano Banana) model for generating, editing, and creating AI-powered visual content including infographics, product photos, illustrations, and more. Use when the user asks about nanobana image generator.
Nano Banana Image Generator
Google Gemini 2.5 Flash Image (Nano Banana) model for generating, editing, and creating AI-powered visual content including infographics, product photos, illustrations, and more.
Purpose
Provide farmers and agricultural content creators with AI-powered image generation capabilities using Google's Nano Banana model. This skill enables creation of professional infographics, product mockups, educational visuals, and marketing assets for agricultural documentation, presentations, and promotional materials.
Problem Solved
Creating high-quality agricultural visual content is expensive and time-consuming. Hiring designers for infographics, product photos, and illustrations costs thousands annually. Farmers need professional visuals for grant applications, market materials, educational content, and social media, but lack design skills and budgets. This skill provides free AI-powered image generation for agricultural contexts.
Capabilities
Generate text-to-image visuals from natural language descriptions
Create multi-panel infographics with data visualizations
Generate product mockups and commercial photography
Edit existing images with text prompts (add, remove, modify elements)
Style transfer and artistic transformation
Character consistency across multiple images (up to 14 reference images)
Support for aspect ratios (1:1, 16:9, 21:9, 9:16, etc.)
Multiple resolution options (1K, 2K, 4K)
Google Search integration for real-time data grounding
Batch image generation for multiple concepts
Multi-turn conversation for iterative refinement
SynthID watermark included on all generated images
Returns: Conversation history with all generated images
batch-generate
Description: Generate multiple images in batch.
Parameters:
prompts (array, required): List of image generation prompts
common_config (object, optional): Shared configuration (aspect ratio, resolution) for all images
Returns: Array of generated images with metadata
Environment Variables
# Google AI API
GOOGLE_API_KEY=your_google_api_key_here
# Model Configuration
DEFAULT_MODEL=gemini-2.5-flash-image
DEFAULT_ASPECT_RATIO=1:1
DEFAULT_RESOLUTION=2K
# Search Configuration
ENABLE_GOOGLE_SEARCH=false
SEARCH_REGION=US
# Output Configuration
OUTPUT_DIR=outputs/images
IMAGE_FORMAT=png
SAVE_METADATA=true
# Image Generation
MAX_REFERENCE_IMAGES=14
ENABLE_THINKING_MODE=true
# File Handling
AUTO_OPEN_IMAGES=true
LOG_GENERATED_IMAGES=true
Real-World Examples
Example 1: Generate Agricultural Infographic
from nanobana_generator import NanoBananaGenerator
generator = NanoBananaGenerator()
prompt = """
Create a 3-panel infographic explaining crop rotation benefits for farmers.
Panel 1 (left): Show three-year crop rotation cycle with diagrams of corn, beans, wheat in sequence. Include crop rotation benefits: pest break, nutrient balance, soil health improvement.
Panel 2 (center): Show soil nitrogen levels before and after rotation with bar charts. Include legume nitrogen fixation visualization showing root nodules adding nitrogen.
Panel 3 (right): Show yield improvement data with line graph comparing rotated vs non-rotated fields over 5 years. Include economic benefit calculation.
Style: Professional infographic style with data visualizations, charts, and diagrams. Use agricultural color palette (green #2D7D2F, brown #8B4513, sky blue #87CEEB, yellow #FFD700). Include title "Crop Rotation Benefits" at top, labeled sections, and legend.
"""
image = generator.generate_image(
prompt=prompt,
aspect_ratio="16:9",
resolution="2K"
)
print(f"Generated infographic: {image['file_path']}")
Example 2: Create Product Photography
from nanobana_generator import NanoBananaGenerator
generator = NanoBananaGenerator()
prompt = """
Professional product photograph of organic heirloom tomato seed packets on rustic wooden crate surface.
Composition:
- Center frame: 3 seed packets arranged in triangular composition
- Packets: Front-facing with clear variety names (Cherokee Purple, Brandywine, Mortgage Lifter)
- Background: Weathered wood texture with natural lighting
- Details: Sharp focus on seed packet text, visible seed shapes inside
Lighting: Studio three-point softbox setup, warm color temperature (5500K), subtle highlights on packet edges.
Camera: 50mm lens, f/2.8 aperture for shallow depth of field, product-only focus.
Style: Ultra-realistic, e-commerce quality, sharp focus, natural shadows.
"""
image = generator.generate_image(
prompt=prompt,
aspect_ratio="4:3",
resolution="2K"
)
print(f"Generated product photo: {image['file_path']}")
Example 3: Edit Marketing Material
from nanobana_generator import NanoBananaGenerator
generator = NanoBananaGenerator()
# Load existing product photo
reference_image = "existing_product_photo.png"
prompt = """
Update the background of this product photo to match our farm brand identity:
1. Change background from plain white to gradient using brand colors: dark green (#1B4D3E) to light green (#5D8A4C)
2. Add subtle farm scene elements in corners (wheat stalks, sun rays)
3. Keep product lighting and composition exactly the same
4. Maintain professional e-commerce quality
5. Add brand watermark in bottom right corner
Style: Update should be seamless and natural-looking.
"""
edited_image = generator.edit_image(
image_path=reference_image,
prompt=prompt,
preserve_style=True
)
print(f"Edited image: {edited_image['file_path']}")
Example 4: Multi-Turn Educational Content
from nanobana_generator import NanoBananaGenerator
generator = NanoBananaGenerator()
# Create multi-turn conversation for step-by-step guide
conversation = generator.multi_turn_chat(
initial_prompt="Create a 5-panel comic guide explaining soil testing process for farmers",
iterations=5
)
# conversation contains all images and text historyfor i, turn inenumerate(conversation['history']):
print(f"Step {i+1}: {turn['message']}")
if'image_path'in turn:
print(f" Image: {turn['image_path']}")
Example 5: Ground with Real-Time Weather Data
from nanobana_generator import NanoBananaGenerator
generator = NanoBananaGenerator()
prompt = """
Visualize current weather forecast for next 5 days in Cedar Creek, TX as a clean, modern weather dashboard.
Include:
- Top section: 5-day forecast with daily high/low temperatures, weather icons, and precipitation chances
- Center panel: Temperature trend line graph showing warming trend from Monday to Friday
- Bottom panel: Farm action recommendations for each day (Monday: "Prepare freeze protection", Tuesday: "Monitor for ice melt")
Data accuracy: Use realistic temperatures based on current forecast (highs in 50s-60s F, lows in 20s-30s F). Include date labels and day abbreviations.
Style: Modern dashboard UI with data visualization, clean lines, and agricultural color scheme.
"""
image = generator.generate_image(
prompt=prompt,
use_search=True, # Enable Google Search for current weather data
resolution="2K",
aspect_ratio="16:9"
)
print(f"Generated weather dashboard: {image['file_path']}")
print(f"Grounding data: {image['grounding_metadata']}")
Example 6: Generate Technical Diagrams
from nanobana_generator import NanoBananaGenerator
generator = NanoBananaGenerator()
prompt = """
Create a detailed technical cross-section diagram of a vermicomposting worm bin.
Visual elements to include:
- Cross-section view showing layers (top to bottom)
- Layer 1: Fresh food scraps and bedding (first 3 inches)
- Layer 2: Active composting zone with worms (middle 6 inches)
- Layer 3: Finished vermicast/castings ready for harvest (bottom 3 inches)
- Labels for each layer with dimensions
- Worm locations and movement arrows
- Drainage holes at bottom
- Air ventilation indicators
Style: Technical illustration style like agricultural extension diagrams. Clean lines, clear labels, cross-hatching for material differences. Include scale indicator (1 inch = 2.54 cm).
Title: "Vermicomposting Worm Bin Cross-Section"
Subtitle: "Layer Structure and Composting Zones"
"""
image = generator.generate_image(
prompt=prompt,
aspect_ratio="1:1",
resolution="2K"
)
print(f"Generated technical diagram: {image['file_path']}")
Safety Considerations
All generated images include SynthID watermark (Google's AI generation identifier)
Be aware of copyright when using reference images - ensure you have rights
Verify generated data accuracy when using Google Search grounding
Review Google's Prohibited Use Policy before generating content
Consider data privacy when including real-time farm data in prompts
Test prompts for unwanted content before large-scale generation
Keep API keys secure - never commit to version control
Monitor usage costs - API has rate limits and billing
Troubleshooting
API Authentication Errors
Problem: API key invalid or authentication fails
Solutions:
Verify GOOGLE_API_KEY is set correctly in .env file