nano-banana
Original:🇺🇸 English
Translated
2 scriptsChecked / no sensitive code detected
Generate and edit images using Google's Gemini image generation models (Nano Banana family). Supports style presets, platform-specific sizing (YouTube/slides/blog), variants, image editing via inlineData, reference images for style transfer, and organized output with metadata. Default model is Nano Banana 2 (gemini-3.1-flash-image-preview). Key is auto-decrypted via SOPS.
2installs
Sourceglebis/claude-skills
Added on
NPX Install
npx skill4agent add glebis/claude-skills nano-bananaTags
Translated version includes tags in frontmatterSKILL.md Content
View Translation Comparison →Nano Banana - Gemini Image Generation
Generate and edit images from text prompts via Google's Gemini image generation API.
When to Use
- User requests image generation, creation, or production from a text description
- Editing existing images with text instructions
- Style-transfer: generate new images that match the aesthetic of a reference
- Creating illustrations for presentations, articles, thumbnails, social posts
- Batch variations of the same concept
First-Time Setup
bash
scripts/nano_banana.py initWizard checks dependencies (sops, age, magick), verifies the API key, and saves defaults to .
~/.config/nano-banana/config.yamlQuick Start
bash
# Simple generation
scripts/nano_banana.py "a minimalist illustration of a rocket" ./rocket.png
# With style preset
scripts/nano_banana.py --preset editorial "interconnected nodes" ./nodes.png
# YouTube thumbnail (auto-cropped to 1280x720)
scripts/nano_banana.py --preset grain --platform youtube "coffee on desk" ./thumb.png
# Generate 4 variants + contact sheet
scripts/nano_banana.py --preset wireframe "a crystal" ./crystal.png --n 4
# Edit existing image
scripts/nano_banana.py --edit ./old.png "make the background deep teal" ./new.png
# Style reference (match aesthetic of existing image)
scripts/nano_banana.py --reference ./style.png "a new mountain landscape" ./mountain.png
# Re-roll last prompt
scripts/nano_banana.py again
# View history
scripts/nano_banana.py history -n 10Requirements
- — auto-decrypted from
GEMINI_API_KEYvia SOPS + age. Fallback:secrets.enc.yamlexport GEMINI_API_KEY=... - ,
sops— for key decryptionage - (ImageMagick) — for platform fit + contact sheets
magick - with
python3pyyaml
Models
| Model | Alias | Nano Banana Name | Use When |
|---|---|---|---|
| | Nano Banana 2 | Best instruction following, fast |
| | Nano Banana Pro | Highest quality, text in images |
| | Nano Banana (original) | Legacy |
Use via or full ID.
--model flash|pro|flash-2.5Style Presets
bash
scripts/nano_banana.py list-presets
scripts/nano_banana.py --preset editorial "your subject" out.png| Preset | Style |
|---|---|
| Thin lines on black, muted palette, technical diagram feel |
| White/cyan lines on dark navy, engineering drawing |
| Japanese sumi-e ink wash, organic brushstrokes, monochrome |
| Flat colors, grain, terracotta + sage, zine aesthetic |
| 3D wireframe mesh, glowing edges on black |
| Star map dots connected by faint lines, celestial |
| Bold shapes, thick borders, hard shadows, flat colors |
| Film grain photo, high ISO, warm cinematic tones |
Defined in — edit to add your own.
presets.yamlPlatform Presets
bash
scripts/nano_banana.py list-platforms
scripts/nano_banana.py --platform youtube "your subject" out.pngGenerated image is automatically resized + center-cropped to target dimensions.
| Platform | Size |
|---|---|
| 1280×720 |
| 1080×1920 |
| 1920×1080 |
| 1200×630 |
| 1600×900 |
| 1080×1080 |
| 1080×1920 |
| 1000×1500 |
Features
Variants + Contact Sheet
--n Nbash
scripts/nano_banana.py --preset ink "mountain" ./mt.png --n 6
# Creates mt-01.png ... mt-06.png + mt-contact.pngEdit Mode
Pass an existing image and the prompt becomes the edit instruction:
bash
scripts/nano_banana.py --edit ./thumb.png "remove the watermark, warmer colors" ./clean.pngReference Images (Style Anchor)
Use one or more reference images to guide the aesthetic without editing them:
bash
scripts/nano_banana.py --reference ./episode1.png --reference ./episode2.png \
"episode 3: data drift" ./ep3.pngProjects + Metadata
Organize outputs by project:
bash
scripts/nano_banana.py --project lab-04/meeting-02 --preset editorial "MCP loops" ./overlay.png
# Saves to ~/nano-banana/outputs/lab-04/meeting-02/20260414-<subject>.png + .json sidecarRe-roll + History
bash
scripts/nano_banana.py again # rerun last prompt
scripts/nano_banana.py history -n 20 # show last 20 generations
scripts/nano_banana.py history --project lab-04Dry Run
Preview the composed prompt without calling the API:
bash
scripts/nano_banana.py --preset editorial --platform youtube "subject" --dry-runTransient Errors & Retry
The API occasionally returns or empty candidates. The script retries up to 4 times with exponential backoff (2s, 4s, 8s, 16s). Permanent errors (4xx, safety violations) fail fast without retry.
500/INTERNALPrompt Tips
- Specify visual style: "photograph", "flat illustration", "watercolor", "3D render"
- Include composition: "centered", "white background", "wide shot"
- Name colors: "blue and white color scheme", "warm earth tones"
- For text rendering, use and quote exact text:
--model pro'with the text "Hello"'
See for full API documentation.
references/api_reference.mdFiles
- — main CLI (Python)
scripts/nano_banana.py - — thin bash wrapper (back-compat)
scripts/generate_image.sh - — style presets
presets.yaml - — platform sizing presets
platforms.yaml - — encrypted API key (SOPS + age)
secrets.enc.yaml - — user defaults (from
~/.config/nano-banana/config.yaml)init - — generation log
~/.config/nano-banana/history.jsonl - — last run (for
~/.config/nano-banana/last.json)again