Gemini 3 Pro Image Generator
Generate 2K resolution images from text prompts using Google's Gemini 3 Pro model (Nano Banana Pro).
Quick Start
python ~/.claude/commands/generate-image/scripts/generate_image.py "A beautiful sunset over mountains" -o sunset.png
Prompting Guide
Reference: Nano Banana Pro Prompting Tips
Key Elements for Effective Prompts
Include these elements for nuanced creative control:
Subject: Who or what is in the image? Be specific
- "a stoic robot barista with glowing blue optics"
- "a fluffy calico cat wearing a tiny wizard hat"
Composition: How elements are arranged
- "centered", "rule of thirds", "close-up", "wide shot"
Action: What is happening
- "pouring coffee", "reading a book", "running through rain"
Location: Where the scene takes place
- "in a neon-lit Tokyo alley", "on a misty mountain peak"
Style: Visual aesthetic
- "photorealistic", "watercolor painting", "retro 80s poster"
7 Tips for Best Results
Use Specific Details: Combine subject, composition, action, location, and style in one prompt
Leverage Real-World Knowledge: Gemini 3 Pro understands real-world context - reference real places, products, or cultural elements
Translate and Localize: Generate text in multiple languages for international markets, posters, infographics
Refine with Technical Terms: Add camera angles, lighting conditions, text integration requirements
Blend Multiple Concepts: Combine ideas, translate images, generate visuals with embedded text
Maintain Brand Consistency: Apply designs with consistent styling, drape patterns/logos onto 3D objects while preserving lighting and texture
Know the Limitations: Complex text rendering and factual diagrams may need iteration
Example Prompts
Product Photography:
"Professional product photo of a minimalist smartwatch on white marble surface,
soft studio lighting, slight reflection, centered composition, 8K detail"
Marketing Banner:
"Modern tech startup banner with text 'Innovation Starts Here',
gradient blue to purple background, geometric shapes, clean typography"
Artistic Portrait:
"Cinematic portrait of a jazz musician in a smoky club,
warm amber lighting, shallow depth of field, 1950s New York aesthetic"
Options
-o, --output: Output file path (default: generated_image.png)
-a, --aspect-ratio: Aspect ratio (default: 16:9)
- Square: 1:1
- Portrait: 2:3, 3:4, 4:5, 9:16
- Landscape: 3:2, 4:3, 5:4, 16:9, 21:9
Examples
# 16:9 landscape image (default)
python ~/.claude/commands/generate-image/scripts/generate_image.py "Futuristic city skyline at night, cyberpunk aesthetic, neon lights reflecting on wet streets" -o city.png
# Square image for social media
python ~/.claude/commands/generate-image/scripts/generate_image.py "Flat lay of coffee and pastries on wooden table, morning light, cozy cafe aesthetic" -o product.png -a 1:1
# Portrait for mobile
python ~/.claude/commands/generate-image/scripts/generate_image.py "Fashion editorial, model in avant-garde outfit, dramatic studio lighting, high contrast" -o fashion.png -a 9:16
Requirements
- Python 3.8+
GEMINI_API_KEY in ~/.env
API Details
- Model: gemini-3-pro-image-preview (fixed)
- Resolution: 2K (fixed)
- Endpoint: Google Generative Language API v1beta
- Output: JPEG format
Troubleshooting
API Key Not Found
Ensure ~/.env contains:
GEMINI_API_KEY=your_api_key_here
Timeout Errors
The default timeout is 120 seconds. For complex prompts, the API may take longer.
No Image in Response
Some prompts may be rejected by safety filters. Try rephrasing the prompt.
1---2name: generate-image3description: Generate 2K images using Gemini 3 Pro API. Creates high-quality images from text prompts with various aspect ratios.4---56# Gemini 3 Pro Image Generator78Generate 2K resolution images from text prompts using Google's Gemini 3 Pro model (Nano Banana Pro).910## Quick Start1112```bash13python ~/.claude/commands/generate-image/scripts/generate_image.py "A beautiful sunset over mountains" -o sunset.png14```1516## Prompting Guide1718Reference: [Nano Banana Pro Prompting Tips](https://blog.google/products-and-platforms/products/gemini/prompting-tips-nano-banana-pro/)1920### Key Elements for Effective Prompts2122Include these elements for nuanced creative control:23241. **Subject**: Who or what is in the image? Be specific25 - "a stoic robot barista with glowing blue optics"26 - "a fluffy calico cat wearing a tiny wizard hat"27282. **Composition**: How elements are arranged29 - "centered", "rule of thirds", "close-up", "wide shot"30313. **Action**: What is happening32 - "pouring coffee", "reading a book", "running through rain"33344. **Location**: Where the scene takes place35 - "in a neon-lit Tokyo alley", "on a misty mountain peak"36375. **Style**: Visual aesthetic38 - "photorealistic", "watercolor painting", "retro 80s poster"3940### 7 Tips for Best Results41421. **Use Specific Details**: Combine subject, composition, action, location, and style in one prompt43442. **Leverage Real-World Knowledge**: Gemini 3 Pro understands real-world context - reference real places, products, or cultural elements45463. **Translate and Localize**: Generate text in multiple languages for international markets, posters, infographics47484. **Refine with Technical Terms**: Add camera angles, lighting conditions, text integration requirements49505. **Blend Multiple Concepts**: Combine ideas, translate images, generate visuals with embedded text51526. **Maintain Brand Consistency**: Apply designs with consistent styling, drape patterns/logos onto 3D objects while preserving lighting and texture53547. **Know the Limitations**: Complex text rendering and factual diagrams may need iteration5556### Example Prompts5758**Product Photography:**59```60"Professional product photo of a minimalist smartwatch on white marble surface,61soft studio lighting, slight reflection, centered composition, 8K detail"62```6364**Marketing Banner:**65```66"Modern tech startup banner with text 'Innovation Starts Here',67gradient blue to purple background, geometric shapes, clean typography"68```6970**Artistic Portrait:**71```72"Cinematic portrait of a jazz musician in a smoky club,73warm amber lighting, shallow depth of field, 1950s New York aesthetic"74```7576## Options7778- `-o, --output`: Output file path (default: generated_image.png)79- `-a, --aspect-ratio`: Aspect ratio (default: 16:9)80 - Square: 1:181 - Portrait: 2:3, 3:4, 4:5, 9:1682 - Landscape: 3:2, 4:3, 5:4, 16:9, 21:98384## Examples8586```bash87# 16:9 landscape image (default)88python ~/.claude/commands/generate-image/scripts/generate_image.py "Futuristic city skyline at night, cyberpunk aesthetic, neon lights reflecting on wet streets" -o city.png8990# Square image for social media91python ~/.claude/commands/generate-image/scripts/generate_image.py "Flat lay of coffee and pastries on wooden table, morning light, cozy cafe aesthetic" -o product.png -a 1:19293# Portrait for mobile94python ~/.claude/commands/generate-image/scripts/generate_image.py "Fashion editorial, model in avant-garde outfit, dramatic studio lighting, high contrast" -o fashion.png -a 9:1695```9697## Requirements9899- Python 3.8+100- `GEMINI_API_KEY` in `~/.env`101102## API Details103104- **Model**: gemini-3-pro-image-preview (fixed)105- **Resolution**: 2K (fixed)106- **Endpoint**: Google Generative Language API v1beta107- **Output**: JPEG format108109## Troubleshooting110111### API Key Not Found112Ensure `~/.env` contains:113```114GEMINI_API_KEY=your_api_key_here115```116117### Timeout Errors118The default timeout is 120 seconds. For complex prompts, the API may take longer.119120### No Image in Response121Some prompts may be rejected by safety filters. Try rephrasing the prompt.