Loading...
Loading...
通过`runcomfy` CLI在RunComfy上实现图像Outpainting——将静态图像扩展至原始画布之外,补全相机未捕捉到的内容,在保留原始内容的同时更改宽高比(正方形→16:9、竖屏→横屏)。支持调用Nano Banana 2 Edit(默认选项,基于空间语言驱动)、GPT Image 2 Edit(多参考图,匹配参考风格)、FLUX Kontext Pro(单次处理,最大程度保留原图)以及品牌专属编辑端点(Seedream / Dreamina / Qwen / FLUX 2)。会根据扩图需求是文本描述驱动、参考图驱动还是品牌风格锁定,选择合适的调用路径。当出现以下关键词时触发该功能:"outpaint"、"outpainting"、"extend image canvas"、"expand the image"、"fill in around the photo"、"uncrop"、"change aspect ratio"、"extend frame"、"wide-screen from square",或任何明确要求为现有静态图像添加画布的指令。
npx skill4agent add prime-skills/runcomfy-agent-skills image-outpainting# 1. 安装(详见runcomfy-cli技能)
npm i -g @runcomfy/cli # 或:npx -y @runcomfy/cli --version
# 2. 登录
runcomfy login # 或在CI环境中:export RUNCOMFY_TOKEN=<token>
# 3. 执行扩图
runcomfy run google/nano-banana-2/edit \
--input '{"prompt": "...extend canvas...", "image_urls": ["..."]}' \
--output-dir ./outruncomfy-cligoogle/nano-banana-2/edit保留图像特征的编辑;支持空间语言指令("将画布左右各扩展约30%", "在建筑上方添加天空")。输出结果为更宽的画布,且原始内容得以保留。 适用场景:宽高比更改(正方形→16:9)、还原竖屏图像的裁剪区域、扩展风景照片并匹配周边环境。 不适用场景:需要精准匹配纹理接缝的像素级扩展——请使用ComfyUI扩图工作流。
openai/gpt-image-2/edit支持最多10张参考图,精准遵循布局指令。当扩图需要匹配参考风格或包含布局调整时非常实用。 适用场景:合成扩图(扩展画布 + 从另一张图中粘贴元素)、更改画布时调整布局。 不适用场景:无外部参考图的简单扩图。
blackforestlabs/flux-1-kontext/pro/edit单指令、高保真编辑。使用格式:适用场景:单次处理扩图,且需最大程度保留原始内容。"将画布扩展至16:9宽高比。添加匹配的天空和建筑,延续现有场景。完全保留原图中的所有内容。"
品牌专属编辑端点(,bytedance/seedream-5/lite/edit,bytedance/dreamina-4-0/edit,qwen/qwen-image/qwen-image-edit-2511等)。 适用场景:扩图结果需与源图像保持相同品牌/风格。完整的编辑路由请查看blackforestlabs/flux-2-pro/edit。image-edit
google/nano-banana-2/editruncomfy run google/nano-banana-2/edit \
--input '{
"prompt": "将画布扩展至16:9宽高比,在图像左右两侧添加匹配的环境。延续现有背景风格——相同的光线、相同的拍摄距离、相同的调色板。完全保留原始主体、姿势、构图和中心内容。",
"image_urls": ["https://your-cdn.example/portrait-1to1.jpg"],
"aspect_ratio": "16:9"
}' \
--output-dir ./outruncomfy run google/nano-banana-2/edit \
--input '{
"prompt": "向下扩展画布,展示主体完整的上半身和手臂。延续现有服装风格、光线和背景。完全保留面部和当前可见区域。",
"image_urls": ["https://your-cdn.example/head-and-shoulders.jpg"]
}' \
--output-dir ./out"将画布扩展至[宽高比]""向下扩展""向两侧各扩展约30%""完全保留[原始可见区域]与输入图像一致"aspect_ratioimages: [原图, 风格参考图]comfyui-image-outpainting-workflowflux-klein-unified-image-editing-inpaint-remove-outpaint-in-comfyui-advanced-image-restorationaspect_ratio: "9:16"aspect_ratio: "21:9""16:9"image-inpaintingvideo-outpaintingbest-image-editing-modelsnano-bananaflux-kontextseedream| 代码 | 含义 |
|---|---|
| 0 | 成功 |
| 64 | CLI参数错误 |
| 65 | 输入JSON错误/ schema不匹配 |
| 69 | 上游服务5xx错误 |
| 75 | 可重试:超时/429请求过多 |
| 77 | 未登录或令牌被拒绝 |
runcomfy run--output-dirnpm i -g @runcomfy/clinpx -y @runcomfy/cliruncomfy login~/.config/runcomfy/token.jsonRUNCOMFY_TOKEN--inputmodel-api.runcomfy.net*.runcomfy.net*.runcomfy.comBash(runcomfy *)runcomfy-cliimage-editimage-inpaintingai-image-generationvideo-outpainting