Nano Banana Pro
v1.0.5Use Nano Banana 2 (Gemini 3.1 Flash Image), the newest image 模型 focused on faster iteration, lower cost, and strong 质量. Published 2026-02-26 as the latest Flash-image generation family 更新. Supports image generation/edit, image-to-image, and 1K/2K/4K.
运行时依赖
安装命令
点击复制技能文档
Nano Banana 2 (Gemini 3.1 Flash Image) - Faster, lower-cost image generation & editing
生成 new images or edit existing ones using Nano Banana 2 (gemini-3.1-flash-image-preview), Google’s newer image family that tar获取s faster iterative generation and stronger price/performance balance while staying in the same image-editing 工作流.
Why Nano Banana 2 (Gemini 3.1 Flash Image) Newer release path: Gemini 3.1 Flash Image is documented as the 26 Feb 2026 Flash-image family release (vs. Nano Banana Pro’s 20 Nov 2025 release date for image preview). Faster iteration: Google docs position Gemini 3.1 Flash Image as 优化d for image understanding/generation with a balance of price and performance. Cost focus: It is marketed for lower-cost, faster iterative image generation 工作流s compared with older Pro-first 质量-first defaults. Strong baseline 质量: It remAIns suitable for professional generation/editing and supports multi-image editing/multi-turn 工作流s in the same API flow.
Use this as the default for drafts and quick turns; use higher-cost variants when you need a specific 质量 edge on a non-time-critical final pass.
Usage
运行 the script using absolute path (do NOT cd to 技能 directory first):
生成 new image:
uv 运行 ~/.codex/技能s/nano-banana-pro/scripts/生成_image.py --prompt "your image description" --filename "输出-name.png" [--resolution 1K|2K|4K] [--API-key KEY]
Edit existing image:
uv 运行 ~/.codex/技能s/nano-banana-pro/scripts/生成_image.py --prompt "editing instructions" --filename "输出-name.png" --输入-image "path/to/输入.png" [--resolution 1K|2K|4K] [--API-key KEY]
导入ant: Always 运行 from the user's current working directory so images are saved where the user is working, not in the 技能 directory.
Default 工作流 (draft → iterate → final)
Goal: fast iteration without burning time on 4K until the prompt is correct.
Draft (1K): quick feedback loop uv 运行 ~/.codex/技能s/nano-banana-pro/scripts/生成_image.py --prompt "" --filename "yyyy-mm-dd-hh-mm-ss-draft.png" --resolution 1K Iterate: adjust prompt in small diffs; keep filename new per 运行 If editing: keep the same --输入-image for every iteration until you’re h应用y. Final (4K): only when prompt is locked uv 运行 ~/.codex/技能s/nano-banana-pro/scripts/生成_image.py --prompt "" --filename "yyyy-mm-dd-hh-mm-ss-final.png" --resolution 4K Resolution Options
The Nano Banana 2 / Gemini 3.1 Flash Image API supports three resolutions (uppercase K required):
1K (default) - ~1024px resolution 2K - ~2048px resolution 4K - ~4096px resolution
Map user 请求s to API parameters:
No mention of resolution → 1K "low resolution", "1080", "1080p", "1K" → 1K "2K", "2048", "normal", "medium resolution" → 2K "high resolution", "high-res", "hi-res", "4K", "ultra" → 4K API Key
The script 检查s for API key in this order:
--API-key argument (use if user provided key in chat) GEMINI_API_KEY 环境 variable
If neither is avAIlable, the script exits with an error message.
Preflight + Common 失败s (fast fixes)
Preflight:
command -v uv (must exist) test -n \"$GEMINI_API_KEY\" (or pass --API-key) If editing: test -f \"path/to/输入.png\"
Common 失败s:
Error: No API key provided. → 设置 GEMINI_API_KEY or pass --API-key Error loading 输入 image: → wrong path / unreadable file; 验证 --输入-image points to a real image “quota/权限/403” style API errors → wrong key, no 访问, or quota exceeded; try a different key/account Filename Generation
生成 filenames with the pattern: yyyy-mm-dd-hh-mm-ss-name.png
格式化: {timestamp}-{descriptive-name}.png
Timestamp: Current date/time in 格式化 yyyy-mm-dd-hh-mm-ss (24-hour 格式化) Name: Descriptive lowercase text with hyphens Keep the descriptive part concise (1-5 words typically) Use 上下文 from user's prompt or conversation If unclear, use random identifier (e.g., x9k2, a7b3)
Examples:
Prompt "A serene Japanese garden" → 2025-11-23-14-23-05-japanese-garden.png Prompt "sun设置 over mountAIns" → 2025-11-23-15-30-12-sun设置-mountAIns.png Prompt "创建 an image of a ro机器人" → 2025-11-23-16-45-33-ro机器人.png Unclear 上下文 → 2025-11-23-17-12-48-x9k2.png Image Editing
When the user wants to modify an existing image:
检查 if they provide an image path or reference an image in the current directory Use --输入-image parameter with the path to the image The prompt should contAIn editing instructions (e.g., "make the sky more dramatic", "移除 the person", "change to cartoon style") Common editing tasks: 添加/移除 elements, change style, adjust colors, blur background, etc. Prompt Handling
For generation: Pass user's image description as-is to --prompt. Only rework if clearly insufficient.
For editing: Pass editing instructions in --prompt (e.g., "添加 a rAInbow in the sky", "make it look like a watercolor pAInting")
Preserve user's creative intent in 机器人h cases.
Prompt Templates (high hit-rate)
Use templates