关于 nano-banana-use
用于通过 Gemini Nano Banana 模型生成、编辑和组合图像的技能。它以 uv 运行 Python 脚本,并支持 API 密钥或 Vertex AI 身份验证。
主要功能
- 01根据提示词生成图像
- 02通过文本提示编辑现有图像
- 03组合多张输入图像
- 04设置模型、宽高比和安全过滤级别
适用场景
- 01根据文字描述生成图像
- 02修改现有图像中的内容
- 03将参考图组合成新图像
安装
复制下面的命令,在终端中运行。
$
npx skills add https:/ / github.com/ cnemri/ google-genai-skills --skill nano-banana-use安装后在 Claude Code 中输入/nano-banana-use确认已加载。
包含的文件
除 SKILL.md 外,安装时一起下载的参考资料和脚本。
scripts/compose_image.pyedit_image.pygenerate_image.py详细介绍
Nano Banana 使用
使用此技能通过 Gemini 的 Nano Banana 模型(gemini-2.5-flash-image 和 gemini-3-pro-image-preview)生成、编辑和合成图像。
此技能使用由 uv 管理的可移植 Python 脚本。
前提条件
确保已在环境中配置以下任一身份验证方式:
-
API Key:
GOOGLE_API_KEY或GEMINI_API_KEY
-
Vertex AI:
GOOGLE_CLOUD_PROJECTGOOGLE_CLOUD_LOCATIONGOOGLE_GENAI_USE_VERTEXAI=1
使用方法
生成图像
步骤 1:确认参数 运行脚本前,请与用户确认以下参数,或说明将使用的默认值:
- 提示词:图像描述。
- 模型:默认为
gemini-3-pro-image-preview。 - 宽高比:默认为
1:1。 - 安全过滤器:默认为
BLOCK_MEDIUM_AND_ABOVE。
步骤 2:运行脚本
使用 uv 运行 Python 脚本:
uv run skills/nano-banana-use/scripts/generate_image.py "A futuristic banana city" --output city.png
编辑图像
根据文本提示词修改现有图像。
uv run skills/nano-banana-use/scripts/edit_image.py original.png "Make the sky purple" --output edited.png
合成图像
根据多张输入图像和提示词生成新图像。
uv run skills/nano-banana-use/scripts/compose_image.py --image style.png --image subject.jpg "A painting of the subject in the style of the first image" --output composition.png
选项
prompt:图像的文本描述。--model:要使用的模型。默认为gemini-3-pro-image-preview。--output:保存图像的文件名。默认为generated_image.png。--aspect-ratio:生成图像的宽高比。默认为1:1。支持:1:1、16:9、4:3、3:4、9:16。--safety-filter-level:安全过滤器阈值。默认为BLOCK_MEDIUM_AND_ABOVE。
评论
支持 Markdown