关于 nano-banana-2
通过 inference.sh 命令行工具 `belt` 使用 Google Gemini 3.1 Flash Image Preview 生成和编辑图像,支持设置图像数量、比例、分辨率及 Google Search grounding。
主要功能
- 01根据文本提示生成图像
- 02编辑提供的输入图像
- 03设置图像数量和宽高比
- 04选择 1K、2K 或 4K 输出
- 05通过 Google Search grounding 提示词
适用场景
- 01按指定风格创作概念图
- 02生成多个 Logo 方案
- 03按目标宽高比生成图像
- 04利用输入图像编辑场景
安装
复制下面的命令,在终端中运行。
$
npx skills add https:/ / github.com/ qu-skills/ superpowers --skill nano-banana-2安装后在 Claude Code 中输入/nano-banana-2确认已加载。
详细介绍
安装 belt CLI skill:
npx skills add belt-sh/cli
Nano Banana 2 - Gemini 3.1 Flash Image Preview
通过 inference.sh CLI 使用 Google Gemini 3.1 Flash Image Preview 生成图像。
快速开始
需要 inference.sh CLI(
belt)。安装说明
belt login
belt app run google/gemini-3-1-flash-image-preview --input '{"prompt": "a banana in space, photorealistic"}'
示例
基础文生图
belt app run google/gemini-3-1-flash-image-preview --input '{
"prompt": "A futuristic cityscape at sunset with flying cars"
}'
多张图像
belt app run google/gemini-3-1-flash-image-preview --input '{
"prompt": "Minimalist logo design for a coffee shop",
"num_images": 4
}'
自定义宽高比
belt app run google/gemini-3-1-flash-image-preview --input '{
"prompt": "Panoramic mountain landscape with northern lights",
"aspect_ratio": "16:9"
}'
图像编辑(使用输入图像)
belt app run google/gemini-3-1-flash-image-preview --input '{
"prompt": "Add a rainbow in the sky",
"images": ["https://example.com/landscape.jpg"]
}'
高分辨率(4K)
belt app run google/gemini-3-1-flash-image-preview --input '{
"prompt": "Detailed illustration of a medieval castle",
"resolution": "4K"
}'
使用 Google 搜索 grounding
belt app run google/gemini-3-1-flash-image-preview --input '{
"prompt": "Current weather in Tokyo visualized as an artistic scene",
"enable_google_search": true
}'
输入选项
| 参数 | 类型 | 描述 |
|---|---|---|
prompt | string | 必填。 要生成或更改的内容 |
images | array | 用于编辑的输入图像(最多 14 张)。支持:JPEG、PNG、WebP |
num_images | integer | 要生成的图像数量 |
aspect_ratio | string | 输出宽高比:"1:1"、"16:9"、"9:16"、"4:3"、"3:4"、"auto" |
resolution | string | "1K"、"2K"、"4K"(默认:1K) |
output_format | string | 图像的输出格式 |
enable_google_search | boolean | 启用实时信息 grounding(天气、新闻等) |
输出
| 字段 | 类型 | 描述 |
|---|---|---|
images | array | 生成或编辑后的图像 |
description | string | 模型的文本描述或响应 |
output_meta | object | 关于输入/输出的定价元数据 |
提示词技巧
风格:照片级写实、插画、水彩、油画、数字艺术、动漫、3D 渲染
构图:特写、广角镜头、航拍视角、微距、肖像、风景
光线:自然光、影棚灯光、黄金时刻、戏剧性阴影、霓虹灯
细节:添加有关纹理、颜色、氛围和气氛的具体细节
示例工作流
# 1. Generate sample input to see all options
belt app sample google/gemini-3-1-flash-image-preview --save input.json
# 2. Edit the prompt
# 3. Run
belt app run google/gemini-3-1-flash-image-preview --input input.json
Python SDK
from inferencesh import inference
client = inference()
# Basic generation
result = client.run({
"app": "google/gemini-3-1-flash-image-preview@0c7ma1ex",
"input": {
"prompt": "A banana in space, photorealistic"
}
})
print(result["output"])
# Stream live updates
for update in client.run({
"app": "google/gemini-3-1-flash-image-preview@0c7ma1ex",
"input": {
"prompt": "A futuristic cityscape at sunset"
}
}, stream=True):
if update.get("progress"):
print(f"progress: {update['progress']}%")
if update.get("output"):
print(f"output: {update['output']}")
相关技能
# Original Nano Banana (Gemini 3 Pro Image, Gemini 2.5 Flash Image)
npx skills add inference-sh/skills@nano-banana
# Full platform skill (all apps)
npx skills add inference-sh/skills@infsh-cli
# All image generation models
npx skills add inference-sh/skills@ai-image-generation
浏览所有图像应用:belt app list --category image
文档
评论
支持 Markdown