关于 image-editing
image-editing 通过 each::sense 使用自然语言修改现有图像,并由其按请求选择编辑模型。它涵盖物体修改、风格与色彩调整、局部填充和画布扩展,也支持参考图像及连续编辑。
主要功能
- 01根据文字指令编辑图像
- 02移除或添加物体
- 03转换风格并调整色彩
- 04支持局部填充与画布扩展
- 05支持参考图像和连续编辑
适用场景
- 01移除照片中的多余元素
- 02应用特定风格或色彩效果
- 03替换物体或扩展画布
安装
复制下面的命令,在终端中运行。
$
npx skills add https:/ / github.com/ awesome-genmedia/ skills --skill image-editing安装后在 Claude Code 中输入/image-editing确认已加载。
详细介绍
图像编辑
使用 each::sense 通过自然语言指令编辑现有图像——这款智能 AI Agent 会自动为你的请求选择最佳模型。
快速开始
需要 each::labs API 密钥。请访问 eachlabs.ai 获取。
使用 curl
curl -X POST https://eachsense-agent.core.eachlabs.run/v1/chat/completions \
-H "Content-Type: application/json" \
-H "X-API-Key: $EACHLABS_API_KEY" \
-d '{
"messages": [{"role": "user", "content": [
{"type": "text", "text": "Change the sky to a dramatic orange and purple sunset. Keep the foreground untouched."},
{"type": "image_url", "image_url": {"url": "https://example.com/landscape-photo.jpg"}}
]
}
],
"stream": false
}'
使用 Python(OpenAI SDK)
from openai import OpenAI
client = OpenAI(
api_key="YOUR_EACHLABS_API_KEY",
base_url="https://eachsense-agent.core.eachlabs.run/v1"
)
response = client.chat.completions.create(
model="eachsense/beta",
messages=[{"role": "user", "content": "Change the sky to a dramatic orange and purple sunset. Keep the foreground untouched."}],
# Images are included in the message content array above
)
print(response.choices[0].message.content)
使用参考图像
curl -X POST https://eachsense-agent.core.eachlabs.run/v1/chat/completions \
-H "Content-Type: application/json" \
-H "X-API-Key: $EACHLABS_API_KEY" \
-d '{
"messages": [{"role": "user", "content": [
{"type": "text", "text": "Apply the color grading and mood from the reference image to the target photo"},
{"type": "image_url", "image_url": {"url": "https://example.com/target-photo.jpg"}},
{"type": "image_url", "image_url": {"url": "https://example.com/style-reference.jpg"}}
]
}
],
"stream": false
}'
图像会以 OpenAI 多模态内容格式放入消息中发送。每个请求最多可包含 4 张图像。
流式传输
设置 "stream": true 可接收实时 SSE 响应,设置 "stream": false 则可在单个响应中获取完整结果。流式传输适合在 UI 中显示进度;非流式传输则更适合脚本和自动化。
可用模型
| 模型 | 能力 | 最适合的用途 |
|---|---|---|
| flux-2-edit | 自然语言图像编辑 | 通用编辑、风格更改、对象修改 |
| flux-fill-pro | 图像修补与扩图 | 填充蒙版区域、扩展画布 |
| eachlabs-bg-remover-v1 | 背景移除 | 分离主体、创建透明背景 |
| topaz-upscale-image | 提升分辨率 | 编辑后放大、恢复细节 |
| kling-face-swap | 替换面部 | 交换不同图像中的面部 |
each::sense 会根据你的指令自动选择合适的图像编辑模型。用通俗的英语描述你想要的更改。
编辑能力
| 类别 | 可执行操作 | 指令示例 |
|---|---|---|
| 对象移除 | 移除不需要的元素 | “移除背景中站着的人” |
| 对象添加 | 添加新元素 | “在长椅旁边添加一只坐着的金毛寻回犬” |
| 风格迁移 | 更改艺术风格 | “将这张照片转换成吉卜力工作室风格的插画” |
| 色彩调色 | 调整色彩和氛围 | “应用温暖的复古胶片效果,带有橙色色调” |
| 图像修补 | 填充或替换区域 | “把旧汽车换成一辆现代 Tesla” |
| 扩图 | 扩展画布 | “向左扩展这张图像,展示更多海滩” |
| 修饰 | 清理瑕疵 | “淡化皮肤瑕疵并提亮眼睛” |
| 季节更换 | 更改时间或季节 | “将场景从夏季改为下雪的冬季” |
| 光照 | 修改光照条件 | “将光照改为黄金时刻的效果,并带有长长的阴影” |
提示词技巧
明确说明要保留的内容
始终说明哪些内容应保持不变,以避免意外修改:
"Change the wall color to teal blue. Keep the furniture, people, and floor exactly as they are."
指定具体区域
使用表示空间位置的语言来指定具体区域:
"In the top-right corner, add a flock of birds flying in V-formation"
"Replace the object on the left side of the table with a vase of sunflowers"
通过对话串联编辑
使用多轮消息依次应用编辑:
{
"messages": [
{"role": "user", "content": "Remove the car from the driveway"},
{"role": "assistant", "content": "..."},
{"role": "user", "content": [
{"type": "text", "text": "Now change the house color to light blue"},
{"type": "image_url", "image_url": {"url": "https://example.com/house.jpg"}},
{"type": "image_url", "image_url": {"url": "https://example.com/landscape-with-powerlines.jpg"}}
]
}
],
"stream": false
}'
风格迁移
curl -X POST https://eachsense-agent.core.eachlabs.run/v1/chat/completions \
-H "Content-Type: application/json" \
-H "X-API-Key: $EACHLABS_API_KEY" \
-d '{
"messages": [{"role": "user", "content": [
{"type": "text", "text": "Transform this city street photo into a Van Gogh Starry Night style painting. Keep the composition and building shapes, but apply swirling brushstrokes and vibrant blues and yellows."},
{"type": "image_url", "image_url": {"url": "https://example.com/city-street.jpg"}}
]
}
],
"stream": false
}'
图像修补(对象替换)
curl -X POST https://eachsense-agent.core.eachlabs.run/v1/chat/completions \
-H "Content-Type: application/json" \
-H "X-API-Key: $EACHLABS_API_KEY" \
-d '{
"messages": [{"role": "user", "content": [
{"type": "text", "text": "Replace the wooden dining table with a sleek modern glass table. Keep the chairs, plates, and everything else on the table exactly the same."},
{"type": "image_url", "image_url": {"url": "https://example.com/dining-room.jpg"}}
]
}
],
"stream": false
}'
扩图(画布扩展)
curl -X POST https://eachsense-agent.core.eachlabs.run/v1/chat/completions \
-H "Content-Type: application/json" \
-H "X-API-Key: $EACHLABS_API_KEY" \
-d '{
"messages": [{"role": "user", "content": [
{"type": "text", "text": "Extend this portrait photo into a full 16:9 landscape by expanding the background on both sides. Continue the indoor environment naturally with consistent lighting and style."},
{"type": "image_url", "image_url": {"url": "https://example.com/portrait-crop.jpg"}}
]
}
],
"stream": false
}'
更改色彩和氛围
curl -X POST https://eachsense-agent.core.eachlabs.run/v1/chat/completions \
-H "Content-Type: application/json" \
-H "X-API-Key: $EACHLABS_API_KEY" \
-d '{
"messages": [{"role": "user", "content": [
{"type": "text", "text": "Convert this daytime photo to a moody nighttime scene. Add soft neon reflections on wet pavement, streetlight glow, and a slight blue color grade. Keep all buildings and structures intact."},
{"type": "image_url", "image_url": {"url": "https://example.com/daytime-street.jpg"}}
]
}
],
"stream": false
}'
批量编辑工作流
# Apply the same edit across multiple product photos
IMAGES=(
"https://example.com/product-1.jpg"
"https://example.com/product-2.jpg"
"https://example.com/product-3.jpg"
)
for IMG in "${IMAGES[@]}"; do
curl -X POST https://eachsense-agent.core.eachlabs.run/v1/chat/completions \
-H "Content-Type: application/json" \
-H "X-API-Key: $EACHLABS_API_KEY" \
-d "{
\"messages\": [{\"role\": \"user\", \"content\": \"Remove the background and replace with a clean white studio backdrop. Add a soft drop shadow beneath the product.\"}],
\"image_urls\": [\"$IMG\"],
\"stream\": false
}"
echo "---"
done
常见问题
- 描述过于模糊:“让它更好看”会导致难以预测的结果。请明确说明要更改什么。
- 忘记说明需要保留的内容:始终说明哪些内容应保持不变,以避免不想要的编辑。
- 指令相互冲突:“移除汽车并把汽车改成红色”自相矛盾。
- 期待蒙版像素级精准:用自然语言描述区域;模型会结合上下文理解区域。
- 一次编辑过多:复杂的多步骤编辑采用连续多轮对话效果更好。
相关技能
文档
评论
支持 Markdown