闲社服务运行正常AI智能体自动化平台
g

Gemini图像生成

技能标识:gemini-image-generation

Generate or edit images with Gemini using the Google GenAI SDK. Use when the user asks to create, transform, render, or save one or more images in an OpenClaw skill workflow.'

作者:admin | 来源记录:ClawHub
登记来源
ClawHub
版本
V 1.0.10
检测标记
后台标记通过
免费
免费获取
1
收藏
来源与检测标记为平台登记信息,并不代表已展示可复核的检测报告。使用前请核对版本、依赖和所需权限,建议先在隔离环境中运行。
概述
安装方式
版本历史

Gemini图像生成

图像生成

当你需要根据文本提示创建一个或多个图像文件,或使用Gemini编辑一个或多个现有图像时,使用此技能。

要求

  • - ~/.openclaw/openclaw.json 必须包含 $.skills.entries[gemini-image-generation].enabled 设置为 true。
  • ~/.openclaw/openclaw.json 必须包含 $.skills.entries[gemini-image-generation].env,并包含以下键值对:
  • GEMINIAPIKEY 必填
  • GEMINIMODELID 必填
  • GEMINIBASEURL 可选
  • - 示例 ~/.openclaw/openclaw.json:
json { ......, skills: { entries: { gemini-image-generation: { enabled: true, env: { GEMINIAPIKEY: sk-xxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx, GEMINIMODELID: gemini-3.1-flash-image-preview, GEMINIBASEURL: https://custom-endpoint.com } } } }, ...... }
  • - 工作区环境中必须安装 Node.js。
  • 在技能根目录下使用 npm install 一次性安装依赖。

使用时机

  • - 用户要求根据文本提示生成新图像。
  • 用户要求修改、重新设计样式、扩展或以其他方式编辑一个或多个现有图像。
  • 用户希望将生成的图像保存到工作区文件中。
  • 任务应通过可复用的 OpenClaw 技能处理,而非临时编写的 SDK 代码。

操作步骤

  1. 1. 将用户请求转换为一个清晰的图像提示。
  2. 如果用户提供了源图像,选择或确认工作区内的输入文件路径。
  3. 如果用户指定了目标宽高比或尺寸,通过 --aspectRatio 和 --imageSize 传递。
  4. 除非用户已提供,否则在工作区内选择一个输出路径。
  5. 对于文生图,使用 --prompt、--output 和可选的图像配置参数运行 generate-image.mjs。
  6. 对于图像编辑,使用 --prompt、一个或多个 --input 值、--output 和可选的图像配置参数运行 edit-image.mjs。
  7. 从环境变量中读取 GEMINIAPIKEY 中的 API 密钥和 GEMINIMODELID 中的模型 ID。
  8. 可选地,从环境变量中的 GEMINIBASEURL 读取自定义端点的基础 URL。
  9. 将保存的图像路径返回给用户。
  10. 返回每个图像路径后,同时输出 MEDIA:(例如 MEDIA:outputs/gemini-native-image.png),以便图像在对话中内联显示。

命令

powershell
node ./skills/gemini-image-generation/scripts/generate-image.mjs --prompt Create a picture of a nano banana dish in a fancy restaurant with a Gemini theme --output outputs/gemini-native-image.png

powershell
node ./skills/gemini-image-generation/scripts/generate-image.mjs --prompt Create a wide cinematic food photo of a nano banana dish in a fancy restaurant with a Gemini theme --output outputs/gemini-wide.png --aspectRatio 16:9 --imageSize 2K

powershell
node ./skills/gemini-image-generation/scripts/edit-image.mjs --prompt Turn this cat into a watercolor illustration eating a nano-banana in a fancy restaurant under the Gemini constellation --input inputs/cat.png --output outputs/cat-watercolor.png --aspectRatio 5:4 --imageSize 2K

powershell
node ./skills/gemini-image-generation/scripts/edit-image.mjs --prompt Create an office group photo of these people making funny faces --input inputs/person-1.jpg --input inputs/person-2.jpg --input inputs/person-3.jpg --output outputs/group-photo.png

注意事项

  • - 脚本会输出 TEXT: 行用于模型文本,IMAGE: 行用于每个保存的文件。
  • 技能完成后,始终通过为每个保存的图像路径输出 MEDIA: 来向用户展示所有生成的图像。这确保图像在对话中与文件路径一起内联渲染。
  • 最终的 JSON 摘要仅包含生成的图像路径和可选的图像配置,因此提示、模型 ID 和源图像路径不会回显到日志中。
  • 保存的文件扩展名遵循返回的图像 MIME 类型。如果请求的输出路径使用不同的后缀,脚本会保留基本名称,并使用返回的类型写入文件。
  • 如果模型返回多个图像,脚本会将其保存为 name-1.png、name-2.png 等。
  • edit-image.mjs 支持重复的 --input 标志。你也可以将逗号分隔的列表传递给单个 --input 值。
  • edit-image.mjs 从 .png、.jpg、.jpeg 或 .webp 推断源 MIME 类型。对所有输入使用一个 --mime-type,或重复 --mime-type 使其与每个 --input 对应。
  • 两个脚本都接受 --aspectRatio 和 --imageSize。它们也接受短横线命名形式 --aspect-ratio 和 --image-size。
  • 脚本仅在至少提供其中一个参数时发送 config.imageConfig。

标签

skill ai

通过对话安装

以下为平台配置的接入选项,并非逐项实测通过。能否安装取决于客户端支持、技能来源和运行环境:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 gemini-image-generation-1776163689 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 gemini-image-generation-1776163689 技能

通过命令行安装

skillhub install gemini-image-generation-1776163689

下载

⬇ 下载 gemini-image-generation v1.0.10(免费)

文件大小: 6.98 KB | 发布时间: 2026-4-15 12:52

v1.0.10 最新 2026-4-15 12:52
No user-facing changes in this release.

- Version bump to 1.0.10 with no file modifications or content updates detected.
返回顶部