nano-banana-imagegen
Generate and edit images using Google Gemini image models via the nano-banana CLI. Use when the user asks to create, generate, make, or edit images with AI. Supports text-to-image, image editing, style transfer, and multi-image composition. Trigger on requests like "create an image", "generate a picture", "make me a logo", "edit this photo", "add X to this image".
- License 许可
- MIT
- 最近更新
- 2026-11-12
- Stars
- ★ 348
- Forks
- 56
01 前言 Front Matter
- name
- nano-banana-imagegen
- description
- Generate and edit images using Google Gemini image models via the nano-banana CLI. Use when the user asks to create, generate, make, or edit images with AI. Supports text-to-image, image editing, style transfer, and multi-image composition. Trigger on requests like "create an image", "generate a picture", "make me a logo", "edit this photo", "add X to this image".
02 资源文件 6
- 参考文档references/headers-and-heroes.md1.9 KB
- 参考文档references/icons-and-logos.md1.8 KB
- 参考文档references/illustrations.md2.7 KB
- 参考文档references/photography-and-editing.md3.6 KB
- 参考文档references/prompting-guide.agent.md3.7 KB
- 参考文档references/prompting-guide.md8.8 KB
03 SKILL.md 正文
Nano Banana Image Generation
Generate and edit images using Google's Gemini image models. This skill ships the
pi-nano-banana CLI (a TypeScript wrapper — no Python) that resolves the
GEMINI_API_KEY for you and delegates to @the-focus-ai/nano-banana.
Prerequisites
GEMINI_API_KEYset via the environment or a gitignored.envin the project or package directory (the CLI resolves it automatically).- Network access — the underlying
@the-focus-ai/nano-bananaCLI is fetched vianpx.
Quick Reference
Prefer the bundled pi-nano-banana bin (auto key resolution, output-dir creation):
# Generate a new image
pi-nano-banana "a serene mountain landscape at sunset"
# Edit an existing image
pi-nano-banana "add a hot air balloon to the sky" --file photo.jpg
# Specify output path
pi-nano-banana "a minimalist logo" --output logo.png
# Use a specific model / faster flash model
pi-nano-banana "detailed illustration" --model gemini-2.0-flash-exp
pi-nano-banana "a quick sketch" --flash
The raw CLI still works if you prefer it (npx @the-focus-ai/nano-banana "…").
For batch generation from code, import batchGenerate from
@blackbelt-technology/pi-dashboard-nano-banana/nano-banana.js.
Workflow
Step 1: Understand the Request
Before generating, clarify:
- Subject: What should be in the image?
- Style: Photorealistic, illustration, cartoon, abstract?
- Mood: Bright, dark, moody, cheerful?
- Composition: Close-up, wide shot, specific aspect ratio?
- Use case: Hero image, icon, social media, print?
Step 2: Craft an Effective Prompt
Read references/prompting-guide.md for comprehensive guidance.
Key principles:
- Be specific and descriptive
- Include style references
- Specify what you DON'T want
- Describe composition and framing
Example — Weak prompt:
"a cat"
Example — Strong prompt:
"A fluffy orange tabby cat curled up on a velvet armchair, soft afternoon sunlight streaming through a window, warm cozy interior, photorealistic style, shallow depth of field"
Step 3: Generate the Image
npx @the-focus-ai/nano-banana "your detailed prompt here"
Default output: output/generated-<timestamp>.png
Step 4: Iterate
If the result isn't right:
- Refine the prompt — Add more detail or constraints
- Edit the image — Use
--fileto modify the generated image - Try a different model — Some models handle certain styles better
Commands
Text-to-Image Generation
npx @the-focus-ai/nano-banana "<prompt>"
Image Editing
npx @the-focus-ai/nano-banana "<edit instruction>" --file <input-image>
Edit instructions should describe the change:
- "Remove the background and replace with a gradient"
- "Add sunglasses to the person"
- "Change the sky to sunset colors"
- "Make it look like a watercolor painting"
Options
| Option | Description |
|---|---|
--file <image> |
Input image for editing |
--output <path> |
Custom output path |
--model <name> |
Specific Gemini model |
--flash |
Use gemini-2.0-flash (faster, simpler images) |
--prompt-file <path> |
Read prompt from file |
--list-models |
Show available models |
--api-key <key> |
Explicit Gemini key |
--backend gemini|pi |
Backend (default gemini; pi is opt-in, see below) |
pi backend (opt-in, OpenRouter)
--backend pi (or NANO_BANANA_BACKEND=pi) generates through pi's own model
runtime instead of the Gemini CLI — no GEMINI_API_KEY needed.
- Credential: sign in to OpenRouter in pi (
/login openrouter) or setOPENROUTER_API_KEY. - Requires
@earendil-works/pi-coding-agent >= 1.0.0resolvable next to this package. - Opt-in only: a missing Gemini key never falls back to pi; library callers
(e.g. the video-production storyboard) stay on Gemini unless they pass
backend: "pi". - Models are OpenRouter image ids. Bare Gemini ids get
google/in front (--model gemini-3-pro-image→google/gemini-3-pro-image); non-Google models need the fullvendor/modelid (black-forest-labs/flux.2-pro). Defaultgoogle/gemini-2.5-flash-image;--flashmaps togoogle/gemini-3.1-flash-lite-image.gemini-2.0-flash-expdoes not exist there — an unknown id lists the known ones. - Cost: the success line prints
(pi · <model>) · ~$<cost> est.— an estimate computed from token usage, not the billed amount.
pi-nano-banana "a red fox in the snow, watercolor" -o fox.png --backend pi
pi-nano-banana "make it night" --file fox.png -o fox-night.png --backend pi
Best Practices
For Better Results
- Start with composition: Describe the layout first, then details
- Use artistic references: "in the style of Studio Ghibli", "like a National Geographic photo"
- Specify lighting: "golden hour lighting", "dramatic chiaroscuro", "soft diffused light"
- Include negative guidance: Describe what to avoid in the prompt itself
- Consider aspect ratio: The model generates square by default; describe wide/tall if needed
For Editing
- Be specific about changes: "Add a blue butterfly to the top-left corner"
- Preserve what works: "Keep the background unchanged, only modify the foreground"
- Iterative refinement: Make one change at a time for better control
Environment Setup
Ensure GEMINI_API_KEY is set:
export GEMINI_API_KEY="your-api-key-here"
Or create a .env file in your project:
GEMINI_API_KEY=your-api-key-here
Troubleshooting
| Problem | Solution |
|---|---|
| "No image in response" | Prompt may have triggered safety filters — rephrase |
| Poor quality results | Add more specific style guidance, use gemini-2.0-flash-exp |
--backend pi: "Provider is not configured" |
Run /login openrouter in pi or set OPENROUTER_API_KEY |
--backend pi: "needs @earendil-works/pi-coding-agent >= 1.0.0" |
Install/update pi next to the package |
| Image doesn't match description | Be more explicit about composition, add negative constraints |
04 同仓库更多 Skills
youtube-srt
Download YouTube subtitles (SRT + timestamped TXT) for a channel, playlist or video via yt-dlp, no media download; optionally mine them into a categorized catalog (e.g. AI models by function, open weights, local runnability, hardware tier). Use on "download the srt of this video", "transcripts of channel X for the last N months", "catalog the models AI Search talked about", "update docs/models".
video-transcription
Transcribe video and audio files to SRT subtitles with speaker diarization using the Soniox (default) or AssemblyAI API. Use when the user wants to transcribe meetings, videos, or audio files. Supports MKV, MP4, MOV, M4A, MP3. Triggers on "/transcribe", "transcribe my meetings", "transcribe videos in ~/Movies", or any request to convert audio/video to text.
speaker-id
Name anonymous diarized SRT speakers from a persistent local voiceprint library and repair speaker drift; local, CPU-only, no API key. Triggers "who is speaker 2", "put names on the transcript", "label the meeting SRT", "the diarization split one person into three", "enroll my voice". Backed by the pi-voiceid CLI.
veo-showreel-production-kit
Turn a video timeline + voiceover into a reproducible, sliceable Veo 3.1 prompt package with a consistency anchor and AI storyboard sketches.
veo-generator
Render a scripted video project into mp4 clips with the Google Veo 3.1 API. Reads a project's shot package (shots/*.md), one clip per camera cut, reusing each shot's prompt and sketch — world anchor only with `--with-reference`, seed unless `--no-seed`. Use on "render the Veo video for <project>", "generate the videos from the shot scripts", "make the clips with Veo".
hyperframes-showreel
Turn real screen and site footage into a rhythmic showreel rendered with HyperFrames: sampling, edit script, redacted clips, a generated composition, Veo only as additive FX, music edit + camera punches, delivery render and export QA. Use on "make a showreel from these recordings", "build the HyperFrames video", "assemble the footage edit", "render and QA the showreel".