关于 image-outpainting
image-outpainting 是使用 each::sense 扩展图像原有边界的技能,支持指定方向扩图和调整宽高比,并可通过提示词和会话引导、完善生成区域。
主要功能
- 01水平或垂直扩展图像
- 02转换图像宽高比
- 03扩展背景并扩展裁切画面
- 04创建全景构图
- 05通过提示词引导扩图
- 06在会话中逐步完善结果
适用场景
- 01将人像照片调整为 16:9
- 02扩展产品照片以制作横幅
- 03显示裁切画面之外的场景
- 04将风景图扩展为全景图
安装
复制下面的命令,在终端中运行。
$
npx skills add https:/ / github.com/ eachlabs/ skills --skill image-outpainting安装后在 Claude Code 中输入/image-outpainting确认已加载。
附带文件references/SSE-EVENTS.md
详细介绍
图像扩绘/延展
使用 each::sense 将图像扩展至原始边界之外。此技能运用 AI 智能生成与原图无缝融合的新内容,支持转换宽高比、扩展背景和创意图像延展。
功能
- 横向延展:向左、向右扩展图像,打造更宽的构图
- 纵向延展:在图像上方和下方添加内容,打造更高的画面
- 宽高比转换:将竖版图像转换为横版图像,反之亦然
- 背景扩展:为照片添加更多环境和背景
- 解裁剪:恢复或想象原始画框以外的内容
- 全景图制作:将单张图像扩展为宽幅全景
- 产品照片增强:扩展产品照片,用于横幅和广告
- 艺术作品延展:扩展插画和数字艺术作品
快速开始
curl -X POST https://eachsense-agent.core.eachlabs.run/v1/chat/completions \
-H "Content-Type: application/json" \
-H "X-API-Key: $EACHLABS_API_KEY" \
-H "Accept: text/event-stream" \
-d '{
"messages": [{"role": "user", "content": "Extend this image horizontally to create a wider 16:9 composition, maintaining the same style and lighting"}],
"model": "eachsense/beta",
"stream": true,
"image_urls": ["https://example.com/original-photo.jpg"],
"mode": "max"
}'
常见扩绘场景
| 用例 | 目标比例 | 描述 |
|---|---|---|
| 竖版转横版 | 16:9 | 将竖版照片转换为适用于视频/桌面的横版图像 |
| 正方形转宽屏 | 21:9 | 打造电影感构图 |
| 产品横幅 | 3:1 或 4:1 | 扩展产品照片,用于网页横幅 |
| 社交媒体 | 4:5 或 1:1 | 针对 Instagram 信息流进行优化 |
| 全景图 | 2:1 或 3:1 | 打造宽幅风景图 |
| 满版出血 | 自定义 | 为打印添加页边距 |
用例示例
1. 横向延展图像
curl -X POST https://eachsense-agent.core.eachlabs.run/v1/chat/completions \
-H "Content-Type: application/json" \
-H "X-API-Key: $EACHLABS_API_KEY" \
-H "Accept: text/event-stream" \
-d '{
"messages": [{"role": "user", "content": "Extend this image horizontally on both sides. Add more of the natural environment while keeping the subject centered. Maintain consistent lighting, color grading, and style throughout the extension."}],
"model": "eachsense/beta",
"stream": true,
"image_urls": ["https://example.com/landscape-photo.jpg"],
"mode": "max"
}'
2. 纵向延展图像
curl -X POST https://eachsense-agent.core.eachlabs.run/v1/chat/completions \
-H "Content-Type: application/json" \
-H "X-API-Key: $EACHLABS_API_KEY" \
-H "Accept: text/event-stream" \
-d '{
"messages": [{"role": "user", "content": "Extend this image vertically - add more sky above and more ground/foreground below. Keep the horizon line natural and maintain the same atmosphere and time of day."}],
"model": "eachsense/beta",
"stream": true,
"image_urls": ["https://example.com/landscape.jpg"],
"mode": "max"
}'
3. 将竖版图像转换为横版图像
curl -X POST https://eachsense-agent.core.eachlabs.run/v1/chat/completions \
-H "Content-Type: application/json" \
-H "X-API-Key: $EACHLABS_API_KEY" \
-H "Accept: text/event-stream" \
-d '{
"messages": [{"role": "user", "content": "Convert this vertical portrait photo to a horizontal 16:9 landscape format. Extend the background on both sides to create a wider scene. Keep the person as the main subject and ensure the extended areas match the original environment perfectly."}],
"model": "eachsense/beta",
"stream": true,
"image_urls": ["https://example.com/portrait-photo.jpg"],
"mode": "max"
}'
4. 将正方形图像转换为宽屏图像
curl -X POST https://eachsense-agent.core.eachlabs.run/v1/chat/completions \
-H "Content-Type: application/json" \
-H "X-API-Key: $EACHLABS_API_KEY" \
-H "Accept: text/event-stream" \
-d '{
"messages": [{"role": "user", "content": "Transform this square 1:1 image into a cinematic 21:9 widescreen format. Extend the scene horizontally while preserving the central composition. Match the lighting, textures, and visual style seamlessly."}],
"model": "eachsense/beta",
"stream": true,
"image_urls": ["https://example.com/square-image.jpg"],
"mode": "max"
}'
5. 延展产品照片以制作横幅
curl -X POST https://eachsense-agent.core.eachlabs.run/v1/chat/completions \
-H "Content-Type: application/json" \
-H "X-API-Key: $EACHLABS_API_KEY" \
-H "Accept: text/event-stream" \
-d '{
"messages": [{"role": "user", "content": "Extend this product photo into a wide banner format (approximately 4:1 ratio). Keep the product on the left third of the image and extend the clean background to the right to create space for text overlay. Maintain the same studio lighting and surface texture."}],
"model": "eachsense/beta",
"stream": true,
"image_urls": ["https://example.com/product-shot.jpg"],
"mode": "max"
}'
6. 添加更多背景/环境
curl -X POST https://eachsense-agent.core.eachlabs.run/v1/chat/completions \
-H "Content-Type: application/json" \
-H "X-API-Key: $EACHLABS_API_KEY" \
-H "Accept: text/event-stream" \
-d '{
"messages": [{"role": "user", "content": "Expand this image in all directions to add more environmental context. The subject is too tightly cropped - extend the scene to show more of the surroundings, making it feel less cramped. Keep the original subject size and add approximately 50% more space around it."}],
"model": "eachsense/beta",
"stream": true,
"image_urls": ["https://example.com/tight-crop.jpg"],
"mode": "max"
}'
7. 还原裁剪过的照片
curl -X POST https://eachsense-agent.core.eachlabs.run/v1/chat/completions \
-H "Content-Type: application/json" \
-H "X-API-Key: $EACHLABS_API_KEY" \
-H "Accept: text/event-stream" \
-d '{
"messages": [{"role": "user", "content": "This photo has been tightly cropped - uncrop it to reveal more of the scene. Extend downward to show the full body (currently cut off at the waist) and extend the sides to show more of the room interior. Generate realistic content that matches the existing style."}],
"model": "eachsense/beta",
"stream": true,
"image_urls": ["https://example.com/cropped-photo.jpg"],
"mode": "max"
}'
8. 根据单张图像制作全景图
curl -X POST https://eachsense-agent.core.eachlabs.run/v1/chat/completions \
-H "Content-Type: application/json" \
-H "X-API-Key: $EACHLABS_API_KEY" \
-H "Accept: text/event-stream" \
-d '{
"messages": [{"role": "user", "content": "Transform this landscape photo into a wide panoramic image with a 3:1 aspect ratio. Extend the scenic view on both left and right sides, continuing the mountain range, sky, and terrain naturally. Create a sweeping vista that feels like a real panoramic photograph."}],
"model": "eachsense/beta",
"stream": true,
"image_urls": ["https://example.com/mountain-view.jpg"],
"mode": "max"
}'
9. 延展艺术作品/插画
curl -X POST https://eachsense-agent.core.eachlabs.run/v1/chat/completions \
-H "Content-Type: application/json" \
-H "X-API-Key: $EACHLABS_API_KEY" \
-H "Accept: text/event-stream" \
-d '{
"messages": [{"role": "user", "content": "Extend this digital illustration horizontally to double its width. Continue the artistic style, color palette, and visual elements seamlessly. This is a fantasy landscape illustration - extend the magical forest and atmospheric elements on both sides while maintaining the same painting technique and mood."}],
"model": "eachsense/beta",
"stream": true,
"image_urls": ["https://example.com/fantasy-illustration.jpg"],
"mode": "max"
}'
10. 为人像添加环境
curl -X POST https://eachsense-agent.core.eachlabs.run/v1/chat/completions \
-H "Content-Type: application/json" \
-H "X-API-Key: $EACHLABS_API_KEY" \
-H "Accept: text/event-stream" \
-d '{
"messages": [{"role": "user", "content": "This is a headshot with a blurred background. Extend the image to show more of the environment - convert to a 3/4 or full body shot by extending downward, and widen the scene to show the cafe/office setting implied by the background. Keep the portrait style and depth of field consistent."}],
"model": "eachsense/beta",
"stream": true,
"image_urls": ["https://example.com/headshot.jpg"],
"mode": "max"
}'
多轮扩绘会话
使用 session_id 迭代优化扩绘结果:
# Initial extension request
curl -X POST https://eachsense-agent.core.eachlabs.run/v1/chat/completions \
-H "Content-Type: application/json" \
-H "X-API-Key: $EACHLABS_API_KEY" \
-H "Accept: text/event-stream" \
-d '{
"messages": [{"role": "user", "content": "Extend this beach photo horizontally to create a wider 16:9 composition"}],
"model": "eachsense/beta",
"stream": true,
"image_urls": ["https://example.com/beach.jpg"],
"session_id": "outpaint-beach-001",
"mode": "max"
}'
# Request adjustments
curl -X POST https://eachsense-agent.core.eachlabs.run/v1/chat/completions \
-H "Content-Type: application/json" \
-H "X-API-Key: $EACHLABS_API_KEY" \
-H "Accept: text/event-stream" \
-d '{
"messages": [{"role": "user", "content": "The right side extension looks good, but can you add some palm trees on the left side to balance the composition?"}],
"model": "eachsense/beta",
"stream": true,
"session_id": "outpaint-beach-001"
}'
# Further refinement
curl -X POST https://eachsense-agent.core.eachlabs.run/v1/chat/completions \
-H "Content-Type: application/json" \
-H "X-API-Key: $EACHLABS_API_KEY" \
-H "Accept: text/event-stream" \
-d '{
"messages": [{"role": "user", "content": "Now extend it vertically as well - add more dramatic sky with sunset clouds above"}],
"model": "eachsense/beta",
"stream": true,
"session_id": "outpaint-beach-001"
}'
扩绘提示词技巧
请求延展图像时,请在提示词中包含以下细节:
- 方向:指定横向、纵向或全方向延展
- 目标比例:注明所需的宽高比(16:9、21:9、3:1 等)
- 内容指引:描述延展区域中应出现的内容
- 风格匹配:要求保持一致的光线、色彩和氛围
- 主体位置:指定原始主体应放置的位置
- 用途:注明是否用于横幅、社交媒体、打印等
提示词结构示例
"Extend this [image type] [direction] to [target ratio/size].
[Describe what to add in extended areas].
Maintain [lighting/style/atmosphere] consistency.
Position the original [subject] in the [location]."
模式选择
生成前先询问用户:
“您想要速度快、成本低,还是品质高?”
| 模式 | 适用场景 | 速度 | 品质 |
|---|---|---|---|
max | 最终成品、专业用途、复杂场景 | 较慢 | 最高 |
eco | 快速预览、测试构图、迭代 | 较快 | 良好 |
最佳实践
获取最佳效果
- 高质量源图:从高分辨率原图开始
- 清晰边缘:边缘清晰的图像扩绘效果更自然
- 光线一致:在提示词中描述光线,以便更好地匹配
- 适度延展:延展至原尺寸的 2–3 倍效果最佳
- 反复迭代:使用会话逐步优化结果
应避免的常见问题
- 不要一次延展太多,应逐步进行
- 避免延展边缘带有复杂前景元素的图像
- 对于风格化程度很高或抽象的图像,不要期待完美效果
- 明确说明延展区域中应出现的内容
宽高比参考
| 名称 | 比例 | 常见用途 |
|---|---|---|
| 方形 | 1:1 | Instagram、缩略图 |
| 标准照片 | 4:3 | 传统摄影 |
| Instagram 竖版 | 4:5 | Instagram 信息流 |
| 高清视频 | 16:9 | YouTube、演示文稿 |
| 电影宽屏 | 21:9 | 电影、超宽显示器 |
| 全景 | 2:1、3:1 | 风景、横幅 |
| 横幅 | 4:1、5:1 | 网站页眉、广告 |
错误处理
| 错误 | 原因 | 解决方案 |
|---|---|---|
Failed to create prediction: HTTP 422 | 余额不足 | 在 eachlabs.ai 充值 |
| 内容政策违规 | 内容被禁止 | 调整提示词,使其符合内容政策 |
| 超时 | 生成内容复杂 | 将客户端超时设置为至少 10 分钟 |
| 边缘融合效果差 | 源图像质量较低 | 使用分辨率更高的源图像 |
相关技能
each-sense- 核心 API 文档image-inpainting- 编辑图像中的特定区域image-upscaling- 提升图像分辨率background-removal- 移除和替换背景
评论
支持 Markdown