nano-banana
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinesenano-banana
nano-banana
AI image generation CLI. Default model: Gemini 3.1 Flash Image Preview (Nano Banana 2).
AI图像生成CLI。默认模型:Gemini 3.1 Flash Image Preview (Nano Banana 2)。
/init - First-Time Setup
/init - 首次设置
When the user says "init", "setup nano-banana", or "install nano-banana", run these commands to get the CLI tool on their machine. No sudo required.
Prerequisites: Bun must be installed. If not:
curl -fsSL https://bun.sh/install | bashbash
undefined当用户提到「init」、「设置nano-banana」或者「安装nano-banana」时,运行以下命令在用户设备上安装该CLI工具,无需sudo权限。
前置要求: Bun必须已安装。如果未安装,运行:
curl -fsSL https://bun.sh/install | bashbash
undefined1. Clone the repo
1. Clone the repo
git clone https://github.com/kingbootoshi/nano-banana-2-skill.git ~/tools/nano-banana-2
git clone https://github.com/kingbootoshi/nano-banana-2-skill.git ~/tools/nano-banana-2
2. Install dependencies
2. Install dependencies
cd ~/tools/nano-banana-2 && bun install
cd ~/tools/nano-banana-2 && bun install
3. Link globally (creates nano-banana
command via Bun - no sudo)
nano-banana3. Link globally (creates nano-banana
command via Bun - no sudo)
nano-bananacd ~/tools/nano-banana-2 && bun link
cd ~/tools/nano-banana-2 && bun link
4. Set up API key
4. Set up API key
mkdir -p ~/.nano-banana
echo "GEMINI_API_KEY=<ask user for their key>" > ~/.nano-banana/.env
After init, the user can type `nano-banana "prompt"` from anywhere.
If `bun link` fails or the command is not found after linking, fall back to:
```bash
mkdir -p ~/.local/bin
ln -sf ~/tools/nano-banana-2/src/cli.ts ~/.local/bin/nano-bananamkdir -p ~/.nano-banana
echo "GEMINI_API_KEY=<ask user for their key>" > ~/.nano-banana/.env
初始化完成后,用户可以在任意位置输入 `nano-banana "prompt"` 执行命令。
如果`bun link`执行失败或者链接后找不到命令,使用以下备用方案:
```bash
mkdir -p ~/.local/bin
ln -sf ~/tools/nano-banana-2/src/cli.ts ~/.local/bin/nano-bananaThen ensure ~/.local/bin is on PATH:
Then ensure ~/.local/bin is on PATH:
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc
Get a Gemini API key at: https://aistudio.google.com/apikeyecho 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc
获取Gemini API Key的地址:https://aistudio.google.com/apikeyQuick Reference
快速参考
- Command:
nano-banana "prompt" [options] - Default: 1K resolution, Flash model, current directory
- 命令:
nano-banana "prompt" [options] - 默认配置:1K分辨率,Flash模型,输出到当前目录
Core Options
核心选项
| Option | Default | Description |
|---|---|---|
| | Output filename (no extension) |
| | Image size: |
| model default | Aspect ratio: |
| | Model: |
| current directory | Output directory |
| - | Reference image (can use multiple times) |
| - | Generate on green screen, remove background (FFmpeg) |
| - | Gemini API key (overrides env/file) |
| - | Show cost summary |
| 选项 | 默认值 | 描述 |
|---|---|---|
| | 输出文件名(无需后缀) |
| | 图像尺寸: |
| 模型默认值 | 宽高比: |
| | 模型: |
| 当前目录 | 输出目录 |
| - | 参考图(可多次使用) |
| - | 基于绿幕生成,自动去除背景(依赖FFmpeg) |
| - | Gemini API Key(覆盖环境变量/配置文件设置) |
| - | 展示成本汇总 |
Models
支持的模型
| Alias | Model | Use When |
|---|---|---|
| Gemini 3.1 Flash | Default. Fast, cheap (~$0.067/1K image) |
| Gemini 3 Pro | Highest quality needed (~$0.134/1K image) |
| 别名 | 对应模型 | 使用场景 |
|---|---|---|
| Gemini 3.1 Flash | 默认选项,速度快、成本低(生成1K图像约$0.067/张) |
| Gemini 3 Pro | 需要最高生成质量时使用(生成1K图像约$0.134/张) |
Sizes
尺寸规格
| Size | Cost (Flash) | Cost (Pro) |
|---|---|---|
| ~$0.045 | Flash only |
| ~$0.067 | ~$0.134 |
| ~$0.101 | ~$0.201 |
| ~$0.151 | ~$0.302 |
| 尺寸 | Flash模型成本 | Pro模型成本 |
|---|---|---|
| 约$0.045 | 仅支持Flash模型 |
| 约$0.067 | 约$0.134 |
| 约$0.101 | 约$0.201 |
| 约$0.151 | 约$0.302 |
Aspect Ratios
支持的宽高比
Supported: , , , , , , , , ,
1:116:99:164:33:43:22:34:55:421:9Use flag:
-anano-banana "cinematic scene" -a 16:9支持:、、、、、、、、、
1:116:99:164:33:43:22:34:55:421:9使用参数指定:
-anano-banana "cinematic scene" -a 16:9Key Workflows
核心工作流
Basic Generation
基础生成
bash
nano-banana "minimal dashboard UI with dark theme"
nano-banana "cinematic landscape" -s 2K -a 16:9
nano-banana "quick concept sketch" -s 512bash
nano-banana "minimal dashboard UI with dark theme"
nano-banana "cinematic landscape" -s 2K -a 16:9
nano-banana "quick concept sketch" -s 512Model Selection
模型选择
bash
undefinedbash
undefinedDefault (Flash - fast, cheap)
默认(Flash - 速度快、成本低)
nano-banana "your prompt"
nano-banana "your prompt"
Pro (highest quality)
Pro(最高质量)
nano-banana "detailed portrait" --model pro -s 2K
undefinednano-banana "detailed portrait" --model pro -s 2K
undefinedReference Images (Style Transfer / Editing)
参考图(风格迁移/编辑)
bash
undefinedbash
undefinedEdit existing image
编辑现有图像
nano-banana "change the background to pure white" -r dark-ui.png -o light-ui
nano-banana "change the background to pure white" -r dark-ui.png -o light-ui
Style transfer - multiple references
风格迁移 - 多张参考图
nano-banana "combine these two styles" -r style1.png -r style2.png -o combined
undefinednano-banana "combine these two styles" -r style1.png -r style2.png -o combined
undefinedTransparent Assets
透明素材生成
bash
nano-banana "robot mascot character" -t -o mascot
nano-banana "pixel art treasure chest" -t -o chestThe flag automatically prompts the AI to generate on a green screen, then uses FFmpeg + to key out the background and remove green spill from edge pixels. Pixel-perfect transparency with no manual prompting needed.
-tcolorkeydespillRequires:
brew install ffmpeg imagemagickbash
nano-banana "robot mascot character" -t -o mascot
nano-banana "pixel art treasure chest" -t -o chest-tcolorkeydespill依赖要求:
brew install ffmpeg imagemagickExact Dimensions
精确尺寸控制
To get a specific output dimension:
- First flag: your reference/style image
-r - Last flag: blank image in target dimensions
-r - Include dimensions in prompt
bash
nano-banana "pixel art character in style of first image, 256x256" -r style.png -r blank-256x256.png -o sprite如需生成指定尺寸的图像:
- 第一个参数:传入你的参考/风格图
-r - 最后一个参数:传入目标尺寸的空白图像
-r - 在提示词中说明所需尺寸
bash
nano-banana "pixel art character in style of first image, 256x256" -r style.png -r blank-256x256.png -o spriteReference Order Matters
参考图顺序规则
- First reference: primary style/content source
- Additional references: secondary influences
- Last reference: controls output dimensions (if using blank image trick)
- 第一张参考图:主要风格/内容来源
- 额外参考图:次要风格影响
- 最后一张参考图:如果使用空白图技巧,会控制输出图像的尺寸
Cost Tracking
成本追踪
Every generation is logged to . View summary:
~/.nano-banana/costs.jsonbash
nano-banana --costs每次生成记录都会写入,查看成本汇总:
~/.nano-banana/costs.jsonbash
nano-banana --costsUse Cases
使用场景
- Landing page assets - product mockups, UI previews
- Image editing - transform existing images with prompts
- Style transfer - combine multiple reference images
- Marketing materials - hero images, feature illustrations
- UI iterations - quickly generate variations of designs
- Transparent assets - icons, logos, mascots with no background
- Game assets - sprites, backgrounds, characters
- Video production - visual elements for video compositions
- 落地页素材 - 产品原型、UI预览图
- 图像编辑 - 通过提示词修改现有图像
- 风格迁移 - 融合多张参考图的风格
- 营销物料 - 头图、功能插画
- UI迭代 - 快速生成多种设计变体
- 透明素材 - 无背景的图标、Logo、吉祥物
- 游戏素材 - 精灵图、背景、角色
- 视频制作 - 视频合成用的视觉元素
Prompt Examples
提示词示例
bash
undefinedbash
undefinedUI mockups
UI原型
nano-banana "clean SaaS dashboard with analytics charts, white background"
nano-banana "clean SaaS dashboard with analytics charts, white background"
Widescreen cinematic
宽屏电影质感
nano-banana "cyberpunk cityscape at sunset" -a 16:9 -s 2K
nano-banana "cyberpunk cityscape at sunset" -a 16:9 -s 2K
Product shots with Pro quality
Pro级质量产品图
nano-banana "premium software product hero image" --model pro
nano-banana "premium software product hero image" --model pro
Quick low-res concept
快速低清概念图
nano-banana "rough sketch of a robot" -s 512
nano-banana "rough sketch of a robot" -s 512
Dark mode UI
暗色模式UI
nano-banana "Premium SaaS chat interface, dark mode, minimal, Linear-style aesthetic"
nano-banana "Premium SaaS chat interface, dark mode, minimal, Linear-style aesthetic"
Game assets with transparency (green screen auto-prompted)
带透明背景的游戏素材(自动触发绿幕生成逻辑)
nano-banana "pixel art treasure chest" -t -o chest
nano-banana "pixel art treasure chest" -t -o chest
Portrait aspect ratio
竖屏比例
nano-banana "mobile app onboarding screen" -a 9:16
undefinednano-banana "mobile app onboarding screen" -a 9:16
undefinedAPI Key Setup
API Key设置规则
The CLI resolves the Gemini API key in this order:
- flag
--api-key - environment variable
GEMINI_API_KEY - file in current directory
.env - file next to the CLI script
.env ~/.nano-banana/.env
Get a key at: https://aistudio.google.com/apikey
CLI会按以下优先级读取Gemini API Key:
- 参数传入的值
--api-key - 环境变量
GEMINI_API_KEY - 当前目录下的文件
.env - CLI脚本同级目录下的文件
.env - 文件
~/.nano-banana/.env
获取API Key地址:https://aistudio.google.com/apikey