A comprehensive, AI-friendly toolkit for professional image generation using Google's Gemini 3 Pro Image (Nano Banana Pro) API.
Made by Ashraf Ali
- π¨ Multi-Mode Generation: Text-to-image, image editing, and multi-image composition
- π Aspect Ratio Control: Full support for 1:1, 16:9, 9:16, 4:3, 3:2, 21:9, and more
- π§ Smart Defaults: Auto-detects optimal settings based on your prompt
- π Prompt Templates: Pre-built templates for logos, products, portraits, and more
- π¬ Interactive Chat Mode: Multi-turn refinement with conversation history
- π Validation & Warnings: Catches common pitfalls before generation
- π― System Prompts: Enforce consistent styles across all generations
- π Google Search Grounding: Real-time data for infographics and current events
# Clone the repository
git clone https://github.com/nerveband/nb-pro-image-gen-skill.git
cd nb-pro-image-gen-skill
# Set your API key
export GEMINI_API_KEY="your-api-key-here"# Basic generation
uv run scripts/generate_image.py \
-p "A serene mountain landscape at sunset" \
-f landscape.png
# With aspect ratio
uv run scripts/generate_image.py \
-p "Epic cinematic cityscape" \
-f city.png \
--aspect 21:9
# Using a template
uv run scripts/generate_image.py \
--template photorealistic \
--template-var subject="A majestic lion" \
--template-var action="roaring" \
--template-var setting="African savanna" \
-f lion.pnguv run scripts/generate_image.py \
--prompt "Your description here" \
--filename output.pngSupported ratios: 1:1, 2:3, 3:2, 3:4, 4:3, 4:5, 5:4, 9:16, 16:9, 21:9
# Social media story (vertical)
uv run scripts/generate_image.py \
-p "Quote graphic with bold typography" \
-f story.png \
--aspect 9:16
# Cinematic widescreen
uv run scripts/generate_image.py \
-p "Movie poster design" \
-f poster.png \
--aspect 21:9Enable automatic setting detection based on prompt content:
uv run scripts/generate_image.py \
-p "Professional headshot for LinkedIn" \
-f portrait.png \
--smart
# Auto-selects: aspect=3:4, thinking=highAuto-detection works for:
- Logos β 1:1 aspect, text optimization
- Portraits β 3:4 aspect, high quality
- Landscapes β 16:9 aspect
- Products β 4:3 aspect, commercial style
- Social media β 9:16 or 1:1 aspect
Edit existing images with text instructions:
uv run scripts/generate_image.py \
-p "Add dramatic sunset colors and lens flare" \
-f edited.png \
-i original.pngCombine up to 14 reference images:
uv run scripts/generate_image.py \
-p "Family portrait with everyone smiling" \
-f family.png \
-i person1.png -i person2.png -i person3.pngPerfect for iterative refinement:
uv run scripts/chat_image.pyExample session:
> Create a logo for my coffee shop "Daily Grind"
[Image generated]
> Make it more minimalist and use earth tones
[Refined image]
> Add a coffee bean icon above the text
[Refined image]
> /save daily_grind_logo.png
Saved: /path/to/daily_grind_logo.png
Chat Commands:
/save <filename>- Save the last generated image/aspect <ratio>- Change aspect ratio (clears history)/resolution <size>- Set resolution (1K, 2K, 4K)/search- Toggle Google Search grounding/clear- Clear conversation history/config- Show current settings/help- Show helpexitorquit- Exit chat
Use structured templates for consistent, professional results:
photorealistic: Professional photography with camera specs
uv run scripts/generate_image.py \
--template photorealistic \
--template-var subject="A majestic lion" \
--template-var action="roaring" \
--template-var setting="African savanna at golden hour" \
--template-var camera_angle="low angle shot" \
--template-var lighting="warm golden hour backlighting" \
--template-var lens="200mm telephoto" \
--template-var mood="powerful and majestic" \
-f lion.pngproduct: E-commerce product photography
uv run scripts/generate_image.py \
--template product \
--template-var product="artisan coffee beans in kraft bag" \
--template-var surface="rustic wooden table" \
--template-var lighting="soft natural window light" \
--template-var angle="45-degree angle" \
--template-var style="minimalist lifestyle" \
-f coffee.pnglogo: Clean logo designs
uv run scripts/generate_image.py \
--template logo \
--template-var style="minimalist" \
--template-var elements="coffee bean and steam" \
--template-var colors="black and white" \
--template-var typography="sans-serif" \
--template-var background="white" \
-f logo.pngportrait: Professional portraits
uv run scripts/generate_image.py \
--template portrait \
--template-var subject="confident businesswoman" \
--template-var pose="three-quarter view" \
--template-var lens="85mm" \
--template-var lighting="soft studio lighting" \
--template-var background="neutral gray" \
--template-var mood="professional and approachable" \
-f portrait.pngsocial: Social media graphics
uv run scripts/generate_image.py \
--template social \
--template-var aspect="9:16" \
--template-var headline="Summer Sale" \
--template-var visual="beach sunset with palm trees" \
--template-var details="50% OFF - This Weekend Only" \
-f instagram_story.pngEvery prompt should include:
- Subject - Who or what
- Composition - How it's framed
- Action - What's happening
- Location - Where
- Style - Aesthetic
Example:
Create a cinematic portrait of a jazz musician [subject]
playing saxophone [action] on a rainy Paris street [location],
shot from a low angle [composition]. The style is realistic
with moody blue and orange lighting [style].
- Use natural, full-sentence descriptions
- Be specific about camera angles, lighting, lenses
- Use "MUST" and "NEVER" for strict constraints
- Limit text to 1-3 elements per image
- Include negative constraints ("no text", "no watermarks")
- Use reference images for consistency
- Specify aspect ratios for your use case
- Use keyword soup ("beautiful amazing stunning")
- Request conflicting styles (photorealistic + cartoon)
- Expect perfect small text rendering
- Use 500+ word prompts
- Be vague about technical specs
Vague descriptions: β "A picture of a cat" β "A tabby cat lounging in a sunlit window, warm afternoon light, cozy home interior"
Conflicting styles: β "Photorealistic cartoon character" β "Cartoon character in Pixar 3D animation style"
Text overload: β "Poster with title, subtitle, 5 bullet points, footer text" β "Minimalist poster with bold headline only"
uv run scripts/generate_image.py \
-p "Clean black-and-white logo with text 'Daily Grind', sans-serif font, coffee bean icon, minimalist style" \
-f logo.png \
--aspect 1:1 \
--smartuv run scripts/generate_image.py \
-p "Studio-lit wireless earbuds on polished concrete, 3-point softbox lighting, 45-degree angle, professional e-commerce style" \
-f product.png \
--aspect 4:3 \
--resolution 4K# Step 1: Create base character
uv run scripts/generate_image.py \
-p "Character reference: young wizard with blue robes, silver staff, friendly smile" \
-f wizard_ref.png \
--aspect 1:1
# Step 2: Use as reference for scenes
uv run scripts/generate_image.py \
-p "The wizard casting a spell in an ancient library" \
-f wizard_library.png \
-i wizard_ref.png \
--aspect 16:9uv run scripts/generate_image.py \
-p "Instagram story: bold text 'New Collection' at top, fashion model in center, website at bottom, high contrast" \
-f story.png \
--aspect 9:16 \
--smartRequired Arguments:
--prompt, -p: Image description/prompt--filename, -f: Output filename
Optional Arguments:
--input-image, -i: Input image(s) for editing (can specify multiple)--resolution, -r: Output resolution (1K, 2K, 4K) - default: 1K--aspect, -a: Aspect ratio (1:1, 16:9, 9:16, etc.)--smart: Auto-detect optimal settings--system, -s: System prompt for consistent constraints--search: Enable Google Search grounding--template: Use predefined template--template-var: Template variables (KEY=VALUE)--validate: Enable prompt validation (default: True)--no-validate: Disable validation--api-key, -k: Gemini API key
Interactive mode with no required arguments. Set GEMINI_API_KEY environment variable.
Commands:
- Type prompts naturally for generation
/save <filename>- Save image/aspect <ratio>- Change aspect ratio/resolution <size>- Change resolution/search- Toggle search grounding/clear- Clear history/config- Show settings/help- Show helpexitorquit- Exit
- Visit Google AI Studio
- Create an account or sign in
- Go to API Keys section
- Create a new API key
- Set the environment variable:
export GEMINI_API_KEY="your-api-key-here"
| Resolution | Cost per Image | Best For |
|---|---|---|
| 1K | ~$0.13 | Web, social media, quick iterations |
| 2K | ~$0.14 | Digital displays, presentations |
| 4K | ~$0.24 | Print materials, large displays |
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Built on Google's Gemini 3 Pro Image API
- Inspired by the Nano Banana Pro model
- Thanks to the Google AI team for the amazing image generation capabilities
- Create an issue for bug reports
- Start a discussion for questions
Happy generating! π¨β¨