nano-banana-use

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Nano Banana Use

Nano Banana 使用说明

Use this skill to generate, edit, and compose images using Gemini's Nano Banana models (
gemini-2.5-flash-image
and
gemini-3-pro-image-preview
).
This skill uses portable Python scripts managed by
uv
.
使用该技能可通过Gemini的Nano Banana模型(
gemini-2.5-flash-image
gemini-3-pro-image-preview
)生成、编辑和合成图片。
该技能使用由
uv
管理的可移植Python脚本。

Prerequisites

前置条件

Ensure you have one of the following authentication methods configured in your environment:
  1. API Key:
    • GOOGLE_API_KEY
      or
      GEMINI_API_KEY
  2. Vertex AI:
    • GOOGLE_CLOUD_PROJECT
    • GOOGLE_CLOUD_LOCATION
    • GOOGLE_GENAI_USE_VERTEXAI=1
请确保你的环境中已配置以下身份验证方式之一:
  1. API Key:
    • GOOGLE_API_KEY
      GEMINI_API_KEY
  2. Vertex AI:
    • GOOGLE_CLOUD_PROJECT
    • GOOGLE_CLOUD_LOCATION
    • GOOGLE_GENAI_USE_VERTEXAI=1

Usage

使用方法

Generate an Image

生成图片

Step 1: Confirm Parameters Before running the script, confirm the following parameters with the user or state the defaults you will use:
  • Prompt: The image description.
  • Model: Default is
    gemini-3-pro-image-preview
    .
  • Aspect Ratio: Default is
    1:1
    .
  • Safety Filter: Default is
    BLOCK_MEDIUM_AND_ABOVE
    .
Step 2: Run the Script Run the python script using
uv
:
bash
uv run skills/nano-banana-use/scripts/generate_image.py "A futuristic banana city" --output city.png
步骤1:确认参数 运行脚本前,请与用户确认以下参数,或说明你将使用的默认参数:
  • Prompt:图片描述。
  • Model:默认值为
    gemini-3-pro-image-preview
  • 宽高比:默认值为
    1:1
  • 安全过滤器:默认值为
    BLOCK_MEDIUM_AND_ABOVE
步骤2:运行脚本 使用
uv
运行Python脚本:
bash
uv run skills/nano-banana-use/scripts/generate_image.py "A futuristic banana city" --output city.png

Edit an Image

编辑图片

Modify an existing image based on a text prompt.
bash
uv run skills/nano-banana-use/scripts/edit_image.py original.png "Make the sky purple" --output edited.png
根据文本提示修改现有图片。
bash
uv run skills/nano-banana-use/scripts/edit_image.py original.png "Make the sky purple" --output edited.png

Compose Images

合成图片

Generate a new image based on multiple input images and a prompt.
bash
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
根据多张输入图片和提示生成新图片。
bash
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

Options

可选参数

  • prompt
    : The text description of the image.
  • --model
    : The model to use. Defaults to
    gemini-3-pro-image-preview
    .
  • --output
    : The filename for the saved image. Defaults to
    generated_image.png
    .
  • --aspect-ratio
    : The aspect ratio of the generated image. Defaults to
    1:1
    . Supported:
    1:1
    ,
    16:9
    ,
    4:3
    ,
    3:4
    ,
    9:16
    .
  • --safety-filter-level
    : Safety filter threshold. Defaults to
    BLOCK_MEDIUM_AND_ABOVE
    .
  • 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