| name | nano-banana-pro |
| description | Nano Banana 2 / Gemini 3.1 Flash Image gen/edit: text-to-image, image-to-image, 512/1K/2K/4K, input-image workflows. |
Source: https://github.com/steipete/agent-scripts/tree/main/skills/nano-banana-pro (adopted 2026-05-16)
์ ์ฉ ๋์: Gemini 3.1 Flash Image (Nano Banana 2) API ํธ์ถ. ๊ธฐ์กด image-gen ์คํฌ์ Codex OAuth (OpenAI ์ด๋ฏธ์ง). ๋ณธ ์คํฌ์ Gemini API key ๊ธฐ๋ฐ โ ๋ค๋ฅธ ๋ฐฑ์๋.
Nano Banana 2 Image Generation & Editing
Generate new images or edit existing ones using Google's Nano Banana 2 API (Gemini 3.1 Flash Image).
Script path (adapted)
~/2lab.ai/skills/nano-banana-pro/scripts/generate_image.py
Usage
Run the script using absolute path (do NOT cd to skill directory first):
Generate new image:
uv run ~/2lab.ai/skills/nano-banana-pro/scripts/generate_image.py --prompt "your image description" --filename "output-name.png" [--resolution 512|1K|2K|4K] [--api-key KEY]
Edit existing image:
uv run ~/2lab.ai/skills/nano-banana-pro/scripts/generate_image.py --prompt "editing instructions" --filename "output-name.png" --input-image "path/to/input.png" [--resolution 512|1K|2K|4K] [--api-key KEY]
Important: Always run from ์งํ's current working directory so images are saved where ์งํ is working, not in the skill directory. Default ์ ์ฅ ์์น: ARTIFACTS/images/YYYY-MM/.
Default Workflow (draft โ iterate โ final)
Goal: fast iteration without burning time on 4K until the prompt is correct.
- Draft (1K): quick feedback loop
- Iterate: adjust prompt in small diffs; keep filename new per run
- If editing: keep the same
--input-image for every iteration until ์งํ is happy.
- Final (4K): only when prompt is locked
Resolution Options
The Gemini 3.1 Flash Image API supports these output size values:
- 512 - compact ~512px-class resolution
- 1K (default) - ~1024px resolution
- 2K - ~2048px resolution
- 4K - ~4096px resolution
Map user requests to API parameters:
- "512", "512px", "0.5K", "thumbnail", "tiny" โ
512
- 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 checks for API key in this order:
--api-key argument (use if ์งํ provided key in chat)
GEMINI_API_KEY environment variable
If neither is available, the script exits with an error message.
์งํ ํ๊ฒฝ์์๋ .env ๋๋ ~/2lab.ai/p9/.env์ GEMINI_API_KEY ๋ ๊ฒ (์ด๋ฏธ ์์ ์ ์์).
Preflight + Common Failures (fast fixes)
-
Preflight:
command -v uv (must exist)
test -n "$GEMINI_API_KEY" (or pass --api-key)
- If editing:
test -f "path/to/input.png"
-
Common failures:
Error: No API key provided. โ set GEMINI_API_KEY or pass --api-key
Error loading input image: โ wrong path / unreadable file; verify --input-image points to a real image
- "quota/permission/403" style API errors โ wrong key, no access, or quota exceeded; try a different key/account
Filename Generation
Generate filenames with the pattern: yyyy-mm-dd-hh-mm-ss-name.png
Format: {timestamp}-{descriptive-name}.png
- Timestamp: Current date/time in format
yyyy-mm-dd-hh-mm-ss (24-hour format)
- Name: Descriptive lowercase text with hyphens
- Keep the descriptive part concise (1-5 words typically)
- Use context from user's prompt or conversation
Examples:
- Prompt "A serene Japanese garden" โ
2026-05-16-14-23-05-japanese-garden.png
- Prompt "ํ๋ณต ์
์ ๊ณ ์์ด" โ
2026-05-16-15-30-12-hanbok-cat.png
Image Editing
When ์งํ wants to modify an existing image:
- Check if ์งํ provides an image path or references an image in the current directory
- Use
--input-image parameter with the path to the image
- The prompt should contain editing instructions
- Common editing tasks: add/remove elements, change style, adjust colors, blur background, etc.
Prompt Handling
For generation: Pass ์งํ's image description as-is to --prompt. ํ๊ตญ์ด prompt OK โ Gemini๋ ํ๊ตญ์ด ์ฒ๋ฆฌ ๊ฐ๋ฅ. Only rework if clearly insufficient.
For editing: Pass editing instructions in --prompt (e.g., "add a rainbow in the sky", "make it look like a watercolor painting")
Preserve ์งํ's creative intent in both cases.
Prompt Templates (high hit-rate)
Output
- Saves PNG to current directory (or specified path if filename includes directory)
- Script outputs the full path to the generated image
- Do not read the image back - just inform ์งํ of the saved path
- ํ
๋ ๊ทธ๋จ ์ ์ก ํ์ ์:
mcp__send-file__send_photo (10MB ์ดํ; 4K PNG์ sometimes >10MB โ JPEG ๋ณํ ๋๋ PDF๋ก send_document).
When to use this vs existing image-gen
- ๊ธฐ์กด
image-gen ์คํฌ: OpenAI gpt-image-1 (Codex OAuth ์ฌ์ฉ). ๋น ๋ฅด๊ณ quota ๊ณต์ .
- ๋ณธ ์คํฌ (nano-banana-pro): Google Gemini 3.1 Flash Image. 4K ์ง์, ๋ค๋ฅธ ์คํ์ผ, ๋ณ๋ quota.
- ๊ฐ์ prompt๋ฅผ ์์ชฝ์ ๋๋ ค ๋น๊ตํ๊ณ ์ถ์ ๋ ์ ์ฉ.