关于 image-edit
通过文本提示词转换一张或多张输入图像的图像编辑技能。支持组合图像,并可设置输出比例、分辨率、服务提供方和模型。
主要功能
- 01基于提示词编辑图像
- 02组合多张输入图像
- 03设置宽高比和分辨率
- 04选择服务提供方和模型
- 05以 JSON 返回图像路径
适用场景
- 01修改照片细节
- 02为肖像添加元素
- 03将人物与场景合成
安装
复制下面的命令,在终端中运行。
$
npx skills add https:/ / github.com/ agntswrm/ agent-media --skill image-edit安装后在 Claude Code 中输入/image-edit确认已加载。
详细介绍
图像编辑
使用文本提示词编辑一个或多个图像(图生图转换)。支持输入多张图像,用于融合风格、主体或场景。
命令
npx agent-media@latest image edit --in <paths...> --prompt <text> [options]
输入
| 选项 | 必填 | 说明 |
|---|---|---|
--in | 是 | 一个或多个输入文件路径或 URL |
--prompt | 是 | 对所需编辑效果的文本描述 |
--aspect-ratio | 否 | 输出图像的宽高比(例如,1:1、16:9、auto) |
--resolution | 否 | 输出分辨率(例如,1K、2K、4K) |
--out | 否 | 输出路径、文件名或目录(默认:./) |
--provider | 否 | 要使用的提供方(默认:自动检测) |
--model | 否 | 覆盖模型(例如,fal-ai/flux-2/edit) |
输出
返回包含编辑后图像路径的 JSON 对象:
{
"ok": true,
"media_type": "image",
"action": "edit",
"provider": "fal",
"output_path": "edited_123_abc.png",
"mime": "image/png",
"bytes": 567890
}
示例
编辑单张图像:
npx agent-media@latest image edit --in photo.jpg --prompt "make the sky more vibrant"
向图像中添加元素:
npx agent-media@latest image edit --in portrait.png --prompt "add sunglasses"
合并多张图像(在 --in 后传入多个路径,并以空格分隔):
npx agent-media@latest image edit --in person.png landscape.jpg --prompt "place the person from the first image into the landscape from the second image"
设置宽高比和分辨率进行多图编辑:
npx agent-media@latest image edit --in template.png person.jpg --prompt "Use image one as the template and reframe the person from image two to match" --aspect-ratio 1:1 --resolution 2K --model fal-ai/nano-banana-pro/edit
使用指定提供方进行编辑:
npx agent-media@latest image edit --in scene.jpg --prompt "change to night time" --provider replicate
提供方
此操作需要外部提供方:
- fal - 需要
FAL_API_KEY - replicate - 需要
REPLICATE_API_TOKEN - runpod - 需要
RUNPOD_API_KEY - ai-gateway - 需要
AI_GATEWAY_API_KEY
本地提供方不支持图像编辑。
评论
支持 Markdown