nano-banana-2
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseNano Banana 2 Image Generation & Editing
Nano Banana 2 图片生成与编辑
Generate new images or edit existing images with Nano Banana 2 ().
gemini-3.1-flash-image-preview使用Nano Banana 2()生成新图片或编辑现有图片。
gemini-3.1-flash-image-previewUsage
使用方法
Run the script using absolute or workspace-relative path (do NOT cd into the skill directory first):
Generate new image:
bash
uv run ./.agents/skills/nano-banana-2/scripts/generate_image.py --prompt "your image description" --filename "output-name.png" [--resolution 512px|1K|2K|4K] [--aspect-ratio RATIO] [--api-key KEY]Edit image(s) with references:
bash
uv run ./.agents/skills/nano-banana-2/scripts/generate_image.py --prompt "editing instructions" --filename "output-name.png" --input-image "path/to/input1.png" [--input-image "path/to/input2.png" ...] [--resolution 512px|1K|2K|4K] [--aspect-ratio RATIO] [--api-key KEY]Always run from the user's current working directory so outputs are saved in the active project context.
请使用绝对路径或工作区相对路径运行脚本(请勿先进入技能目录):
生成新图片:
bash
uv run ./.agents/skills/nano-banana-2/scripts/generate_image.py --prompt "你的图片描述" --filename "输出名称.png" [--resolution 512px|1K|2K|4K] [--aspect-ratio 比例] [--api-key 密钥]使用参考图片编辑图片:
bash
uv run ./.agents/skills/nano-banana-2/scripts/generate_image.py --prompt "编辑指令" --filename "输出名称.png" --input-image "输入图片路径1.png" [--input-image "输入图片路径2.png" ...] [--resolution 512px|1K|2K|4K] [--aspect-ratio 比例] [--api-key 密钥]请始终从用户当前工作目录运行,以便将输出保存到当前项目环境中。
Model
模型
Use model code:
- (Nano Banana 2)
gemini-3.1-flash-image-preview
Do not use in this skill.
gemini-3-pro-image-preview使用模型代码:
- (Nano Banana 2)
gemini-3.1-flash-image-preview
请勿在此技能中使用。
gemini-3-pro-image-previewResolution Options
分辨率选项
Nano Banana 2 supports:
- (fastest, low-latency iteration)
512px - (default)
1K 2K4K
Map common user language:
- "quick draft", "thumbnail", "tiny", "512", "0.5K" →
512px - no resolution mention →
1K - "2K", "medium", "normal" →
2K - "4K", "high-res", "ultra", "print quality" →
4K
Use uppercase for , , .
K1K2K4KNano Banana 2支持:
- (速度最快,低延迟迭代)
512px - (默认)
1K 2K4K
用户常用表述对应:
- "快速草稿"、"缩略图"、"小尺寸"、"512"、"0.5K" →
512px - 未提及分辨率 →
1K - "2K"、"中等尺寸"、"常规" →
2K - "4K"、"高分辨率"、"超清"、"印刷质量" →
4K
使用大写表示、、。
K1K2K4KAspect Ratios
宽高比
Supported aspect ratios:
- ,
1:1,1:4,1:8,2:3,3:2,3:4,4:1,4:3,4:5,5:4,8:1,9:16,16:921:9
Map common requests:
- square post / icon →
1:1 - phone wallpaper / vertical reel →
9:16 - widescreen / slide / hero image →
16:9 - cinematic wide →
21:9 - portrait print → or
2:33:4 - panorama banner → or
4:18:1
If unspecified, let the model default behavior apply.
支持的宽高比:
- ,
1:1,1:4,1:8,2:3,3:2,3:4,4:1,4:3,4:5,5:4,8:1,9:16,16:921:9
用户常用需求对应:
- 方形帖子/图标 →
1:1 - 手机壁纸/竖版短视频素材 →
9:16 - 宽屏/幻灯片/首屏图片 →
16:9 - 电影级宽屏 →
21:9 - 竖版印刷品 → 或
2:33:4 - 全景横幅 → 或
4:18:1
若未指定,则采用模型默认行为。
Reference Images (New in Gemini 3 Image workflows)
参考图片(Gemini 3 图片工作流新增功能)
Provide up to 14 reference images when needed by repeating :
--input-image- preserve character consistency
- preserve object fidelity
- combine multiple visual references into one output
Use one image for simple edits; use multiple images for composition or consistency-sensitive tasks.
必要时可通过重复参数提供最多14张参考图片:
--input-image- 保持角色一致性
- 保持物体真实性
- 将多个视觉参考融合到一个输出结果中
简单编辑使用一张图片;合成或对一致性要求高的任务使用多张图片。
API Key
API密钥
Resolve API key in this order:
- argument
--api-key - environment variable
GEMINI_API_KEY
If no key is available, stop and report a clear error.
按以下优先级获取API密钥:
- 参数
--api-key - 环境变量
GEMINI_API_KEY
若没有可用密钥,请停止操作并清晰报告错误。
Filename Generation
文件名生成
Generate filenames as:
yyyy-mm-dd-hh-mm-ss-name.pngExamples:
2026-02-26-17-31-04-japanese-garden.png2026-02-26-17-31-59-social-banner.png
文件名格式为:
yyyy-mm-dd-hh-mm-ss-名称.png示例:
2026-02-26-17-31-04-japanese-garden.png2026-02-26-17-31-59-social-banner.png
Prompt Handling
提示词处理
For generation, pass the user's request as-is unless critically underspecified.
For editing, include explicit transformation instructions in the prompt and preserve the original intent.
对于生成任务,直接传递用户的请求,除非请求严重不明确。
对于编辑任务,在提示词中包含明确的转换指令,并保留原始意图。
Output
输出
- Save PNG to the current directory (or to a provided path in )
--filename - Return the full saved path(s)
- Do not read the output image back unless explicitly requested
- 将PNG保存到当前目录(或参数指定的路径)
--filename - 返回完整的保存路径
- 除非明确要求,否则请勿读取输出图片
Examples
示例
Create a 4K widescreen image:
bash
uv run ./.agents/skills/nano-banana-2/scripts/generate_image.py --prompt "Futuristic city skyline at blue hour with neon reflections" --filename "2026-02-26-17-45-00-futuristic-skyline.png" --resolution 4K --aspect-ratio 16:9Edit with multiple references:
bash
uv run ./.agents/skills/nano-banana-2/scripts/generate_image.py --prompt "Create a polished campaign image that keeps the exact logo details and character identity" --filename "2026-02-26-17-50-10-campaign-image.png" --input-image "logo.png" --input-image "character.png" --resolution 2K --aspect-ratio 4:5创建4K宽屏图片:
bash
uv run ./.agents/skills/nano-banana-2/scripts/generate_image.py --prompt "蓝色时刻的未来城市天际线,带有霓虹倒影" --filename "2026-02-26-17-45-00-futuristic-skyline.png" --resolution 4K --aspect-ratio 16:9使用多张参考图片编辑:
bash
uv run ./.agents/skills/nano-banana-2/scripts/generate_image.py --prompt "创建一张精美的宣传图片,保留logo的所有细节和角色特征" --filename "2026-02-26-17-50-10-campaign-image.png" --input-image "logo.png" --input-image "character.png" --resolution 2K --aspect-ratio 4:5