关于 fal-image-edit
通过 fal.ai 编辑图像的技能,适用于风格迁移、物体移除、背景替换和局部修补等指令式修改。它可搜索合适模型并返回编辑后的图像 URL。
主要功能
- 01风格迁移与通用编辑
- 02移除物体和更换背景
- 03基于蒙版的局部修补
- 04发现适用于编辑任务的模型
- 05输出编辑后的图像 URL
适用场景
- 01为照片应用艺术风格
- 02使用蒙版移除物体
- 03替换图像背景
- 04填充选定的图像区域
MCP 相关
该技能可使用 search_models MCP 工具发现适合的图像编辑模型,再通过选定的 modelId 调用 mcp__fal-ai__generate。
安装
复制下面的命令,在终端中运行。
$
npx skills add https:/ / github.com/ fal-ai-community/ skills --skill fal-image-edit安装后在 Claude Code 中输入/fal-image-edit确认已加载。
附带文件scripts/edit-image.sh
详细介绍
fal.ai 图像编辑
使用 AI 编辑图像:风格迁移、移除对象、更换背景等。
工作原理
- 用户提供图像 URL 和编辑说明
- 脚本选择合适的模型
- 向 fal.ai API 发送请求
- 返回编辑后的图像 URL
查找模型
若要发现最佳且最新的图像编辑模型,请使用搜索 API:
# Search for image editing models
bash /mnt/skills/user/fal-generate/scripts/search-models.sh --category "image-to-image"
# Search for specific editing capabilities
bash /mnt/skills/user/fal-generate/scripts/search-models.sh --query "image editing"
bash /mnt/skills/user/fal-generate/scripts/search-models.sh --query "inpainting"
bash /mnt/skills/user/fal-generate/scripts/search-models.sh --query "object removal"
bash /mnt/skills/user/fal-generate/scripts/search-models.sh --query "background removal"
也可以使用 search_models MCP 工具,并输入相关关键词。
支持的操作
| 操作 | 描述 |
|---|---|
| 风格迁移 | 为图像应用艺术风格 |
| 移除对象 | 从图像中移除对象 |
| 更换背景 | 更换/替换背景 |
| 图像修复 | 填充蒙版区域 |
| 常规编辑 | 基于指令进行编辑 |
用法
bash /mnt/skills/user/fal-image-edit/scripts/edit-image.sh [options]
参数:
--image-url- 要编辑的图像 URL(必填)--prompt- 所需编辑内容的描述(必填)--operation- 编辑操作:style、remove、background、inpaint(默认值:style)--mask-url- 蒙版图像的 URL(修复/移除操作必填)--strength- 编辑强度,范围为 0.0-1.0(默认值:0.75)
示例:
# Style transfer
bash /mnt/skills/user/fal-image-edit/scripts/edit-image.sh \
--image-url "https://example.com/photo.jpg" \
--prompt "Convert to anime style" \
--operation style
# Remove object
bash /mnt/skills/user/fal-image-edit/scripts/edit-image.sh \
--image-url "https://example.com/photo.jpg" \
--prompt "Remove the person on the left" \
--operation remove
# Change background
bash /mnt/skills/user/fal-image-edit/scripts/edit-image.sh \
--image-url "https://example.com/portrait.jpg" \
--prompt "Place in a tropical beach setting" \
--operation background
# Inpainting with mask
bash /mnt/skills/user/fal-image-edit/scripts/edit-image.sh \
--image-url "https://example.com/photo.jpg" \
--mask-url "https://example.com/mask.png" \
--prompt "Fill with flowers" \
--operation inpaint
MCP 工具替代方案
使用 search_models MCP 工具或 search-models.sh,为每种操作(风格迁移、移除对象、更换背景、图像修复)查找当前最佳模型,然后使用找到的 modelId 调用 mcp__fal-ai__generate。
输出
Editing image...
Model: fal-ai/flux/dev/image-to-image
Operation: style transfer
Edit complete!
Image URL: https://v3.fal.media/files/abc123/edited.png
Dimensions: 1024x1024
JSON 输出:
{
"images": [
{
"url": "https://v3.fal.media/files/abc123/edited.png",
"width": 1024,
"height": 1024
}
]
}
向用户展示结果
Here's your edited image:

• 1024×1024 | Operation: Style Transfer
模型选择提示
- 常规编辑:搜索「image editing」模型。适用于基于指令的更改。
- 风格迁移:搜索
image-to-image类别。调整强度:0.3-0.5 表示细微效果,0.7-0.9 表示明显效果。 - 移除对象:搜索「eraser」或「object removal」。有些模型无需蒙版即可工作。
- 更换背景:搜索「background」或「kontext」。寻找能够保留主体特征的模型。
- 图像修复:搜索「inpainting」或「fill」。需要二值蒙版(白色 = 编辑区域)。
蒙版提示
适用于图像修复和某些移除任务:
- 白色像素 = 要编辑的区域
- 黑色像素 = 要保留的区域
- 使用带透明度或纯色的 PNG 格式
- 羽化边缘可实现更平滑的过渡
故障排除
编辑效果过于细微
The edit is barely visible.
Increase the strength parameter:
--strength 0.85
编辑效果过于明显
The edit changed too much of the image.
Decrease the strength parameter:
--strength 0.3
对象未移除
The object wasn't fully removed.
Tips:
1. Be more specific in the prompt
2. Try using an explicit mask
3. Use the inpainting model for precise control
背景瑕疵
The new background has artifacts around the subject.
Tips:
1. Use a cleaner source image
2. Try FLUX Kontext which handles edges better
3. Adjust the strength for smoother blending
评论
支持 Markdown