gemini-image-generator
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseGemini Image Generator
Gemini 图片生成工具
Use this skill to turn a user prompt (and optional images) into Gemini image generation calls via the bundled Python scripts.
使用本Skill,通过内置Python脚本将用户提示词(及可选图片)转换为Gemini图片生成调用请求。
Workflow
工作流程
- Collect the user prompt and any images (local paths or URLs).
- Infer the operation mode and translate parameters into CLI flags.
- Run the appropriate script to generate or edit images.
- Return the output file paths.
- 收集用户提示词及所有图片(本地路径或URL)。
- 推断操作模式,将参数转换为CLI标志。
- 运行对应脚本以生成或编辑图片。
- 返回输出文件路径。
Defaults and Rules
默认设置与规则
- Default model: (CLI value
gemini-2.5-flash-image).flash - Default aspect ratio: .
9:16 - Default count: (max
1).3 - Default image size: , but only apply it for the Pro model.
1K - If the user specifies a size (), switch to Pro (
1K|2K|4K).gemini-3-pro-image-preview - If the user explicitly asks for Pro or higher quality, use Pro.
- If the user supplies multiple reference images (2+), switch to Pro.
- Logo overlay always uses Pro (even if the user asks for Flash).
- Only set when using Pro.
--size
- 默认模型:(CLI参数值为
gemini-2.5-flash-image)。flash - 默认宽高比:。
9:16 - 默认生成数量:(最大为
1)。3 - 默认图片尺寸:,但仅对Pro模型生效。
1K - 若用户指定尺寸(),自动切换为Pro模型(
1K|2K|4K)。gemini-3-pro-image-preview - 若用户明确要求Pro或更高质量,使用Pro模型。
- 若用户提供多张参考图(2张及以上),切换为Pro模型。
- Logo叠加功能始终使用Pro模型(即使用户要求Flash版本)。
- 仅在使用Pro模型时设置参数。
--size
Allowed Values
允许的参数值
- Aspect ratios: ,
1:1,2:3,3:2,3:4,4:3,4:5,5:4,9:16,16:9.21:9 - Image sizes (Pro only): ,
1K,2K.4K - Reference images (Pro): up to 14 total. Gemini guidance: up to 6 object images + up to 5 human images.
- 宽高比:,
1:1,2:3,3:2,3:4,4:3,4:5,5:4,9:16,16:9。21:9 - 图片尺寸(仅Pro模型支持):,
1K,2K。4K - 参考图(Pro模型):最多14张。Gemini官方建议:最多6张物体图 + 最多5张人物图。
Script
脚本
Scripts
脚本列表
Text-to-image
文生图
Run:
bash
python scripts/generate_image.py \
--prompt "<user prompt>" \
--aspect 9:16 \
--count 1 \
--model flash \
--out-dir outputsOnly add flags when the user asks for them. The script reads from the environment.
GEMINI_API_KEY运行命令:
bash
python scripts/generate_image.py \
--prompt "<user prompt>" \
--aspect 9:16 \
--count 1 \
--model flash \
--out-dir outputs仅当用户明确要求时才添加对应标志。脚本会从环境变量中读取。
GEMINI_API_KEYImage editing / image-to-image
图片编辑 / 图生图
Use when the user supplies a base image to edit or transform.
Run:
bash
python scripts/edit_image.py \
--input /path/to/base.png \
--prompt "<edit instructions>" \
--reference /path/to/ref1.png \
--reference https://example.com/ref2.png \
--aspect 9:16 \
--count 1 \
--model flash \
--out-dir outputs当用户提供基础图片用于编辑或转换时使用。
运行命令:
bash
python scripts/edit_image.py \
--input /path/to/base.png \
--prompt "<edit instructions>" \
--reference /path/to/ref1.png \
--reference https://example.com/ref2.png \
--aspect 9:16 \
--count 1 \
--model flash \
--out-dir outputsLogo overlay
Logo叠加
Use when the user wants to place a logo onto a base image.
Run:
bash
python scripts/logo_overlay.py \
--base /path/to/base.png \
--logo /path/to/logo.png \
--aspect 9:16 \
--count 1 \
--model pro \
--out-dir outputs当用户需要将Logo放置到基础图片上时使用。
运行命令:
bash
python scripts/logo_overlay.py \
--base /path/to/base.png \
--logo /path/to/logo.png \
--aspect 9:16 \
--count 1 \
--model pro \
--out-dir outputsExamples
示例
User: "Generate a portrait of a dancer in a foggy forest."
Claude:
- Use defaults (flash, 9:16, count 1).
- Run:
python scripts/generate_image.py --prompt "Generate a portrait of a dancer in a foggy forest."
User: "Make a 2K 16:9 cinematic still of a neon city, give me 3 options."
Claude:
- Use Pro with size 2K, aspect 16:9, count 3.
- Run:
python scripts/generate_image.py --prompt "Make a 2K 16:9 cinematic still of a neon city" --aspect 16:9 --size 2K --count 3 --model pro
User: "Edit this image to remove the background and make it studio white." (with one image)
Claude:
- Use edit script with Flash.
- Run:
python scripts/edit_image.py --input /path/to/image.png --prompt "Remove the background and make it studio white."
User: "Put this logo on the shirt in the photo." (with base + logo images)
Claude:
- Use logo overlay script (Pro).
- Run:
python scripts/logo_overlay.py --base /path/to/photo.png --logo /path/to/logo.png
用户:“生成一张舞者在迷雾森林中的肖像照。”
Claude:
- 使用默认设置(flash模型、9:16宽高比、生成1张)。
- 运行命令:
python scripts/generate_image.py --prompt "Generate a portrait of a dancer in a foggy forest."
用户:“生成3张2K分辨率、16:9比例的霓虹城市场景电影静帧。”
Claude:
- 使用Pro模型,设置尺寸2K、宽高比16:9、生成数量3。
- 运行命令:
python scripts/generate_image.py --prompt "Make a 2K 16:9 cinematic still of a neon city" --aspect 16:9 --size 2K --count 3 --model pro
用户:“编辑这张图片,移除背景并改为纯白工作室背景。”(附带一张图片)
Claude:
- 使用编辑脚本及Flash模型。
- 运行命令:
python scripts/edit_image.py --input /path/to/image.png --prompt "Remove the background and make it studio white."
用户:“把这个Logo放到照片里的衬衫上。”(附带基础图片+Logo图片)
Claude:
- 使用Logo叠加脚本(Pro模型)。
- 运行命令:
python scripts/logo_overlay.py --base /path/to/photo.png --logo /path/to/logo.png
Notes
注意事项
- If the script fails with a missing module, install and retry.
google-genai - Dependencies live in (install with
scripts/requirements.txt).pip install -r scripts/requirements.txt - Output files are written into the directory using timestamped names.
outputs/ - For prompt best practices and templates, read .
references/prompt-guide.md - For logo-specific guidance, read .
references/logo-overlay.md - For edit/image-to-image guidance, read .
references/image-editing.md - For watermarking guidance, read .
references/watermarking.md
- 若脚本因缺失模块运行失败,请安装后重试。
google-genai - 依赖包列表位于(可通过
scripts/requirements.txt安装)。pip install -r scripts/requirements.txt - 输出文件将以时间戳命名,保存至目录。
outputs/ - 关于提示词最佳实践及模板,请查阅。
references/prompt-guide.md - 关于Logo叠加的具体指南,请查阅。
references/logo-overlay.md - 关于图片编辑/图生图的指南,请查阅。
references/image-editing.md - 关于水印添加的指南,请查阅。
references/watermarking.md