Loading...
Loading...
在RunComfy上使用Flux 1 Kontext Pro(Black Forest Labs推出的精准局部图像编辑模型)编辑图片——该技能内置了模型文档中记录的提示词模式,相比直接使用基础提示词调用同一模型,能获得更优质的输出。本文档介绍了Flux Kontext的优势(单参考精准局部编辑、强大的提示词控制、持续高保真输出)、输入格式(单张图片+提示词),以及何时转而使用Nano Banana Edit / GPT Image 2 edit / Flux 2 Klein。通过本地RunComfy CLI调用`runcomfy run blackforestlabs/flux-1-kontext/pro/edit`命令。当触发词为“flux kontext”、“flux-kontext”、“flux 1 kontext”、“kontext”、“BFL kontext”,或用户明确要求使用该模型进行编辑时,启动此技能。
npx skill4agent add prime-skills/runcomfy-agent-skills flux-kontextnpx skills add agentspace-so/runcomfy-skills --skill flux-kontext -g| 需求场景 | 推荐模型 |
|---|---|
| 单张图片精准局部编辑(如“让她拿着X”) | Flux Kontext |
| 高保真保留源图主体特征 | Flux Kontext |
| 批量编辑1–20张图片 | Nano Banana Edit |
| 编辑图片中的多语言/嵌入文本 | GPT Image 2 edit |
| 从零生成图片,无需源图 | Flux 2 Klein |
npm i -g @runcomfy/cliruncomfy loginRUNCOMFY_TOKEN=<token>runcomfy loginblackforestlabs/flux-1-kontext/pro/edit| 字段 | 类型 | 是否必填 | 默认值 | 说明 |
|---|---|---|---|---|
| string | 是 | — | 单个陈述式编辑指令。 |
| string | 是 | — | 单个源图的可公开访问HTTPS URL。 |
| enum | 否 | (输入图比例) | 从模型页面支持的宽高比选项中选择。 |
| int | 否 | — | 重复使用以对比不同变体结果。 |
runcomfy run blackforestlabs/flux-1-kontext/pro/edit \
--input '{
"prompt": "Keep the person'\''s face, pose, and clothing unchanged. Add an orange umbrella in her left hand and a slight smile.",
"image": "https://.../portrait.jpg"
}' \
--output-dir <absolute/path>runcomfy run blackforestlabs/flux-1-kontext/pro/edit \
--input '{
"prompt": "Keep the bottle, label, and lighting unchanged. Replace the brand text on the label from \"ALPHA\" to \"AURA\".",
"image": "https://.../bottle.jpg",
"seed": 42
}' \
--output-dir <absolute/path>"She is now holding an orange umbrella and smiling""保留[主体特征/姿势/构图/品牌元素]不变。"| 使用场景 | 选择Flux Kontext的原因 |
|---|---|
| 单次精准局部编辑 | 专为该场景设计;高保真度 |
| 通过定向修改保留源图主体特征 | 在明确指令下具备强大的特征保留能力 |
| 品牌资产的文字或颜色替换 | 结合引用文本和保留声明的提示词效果极佳 |
| 单张图片快速迭代 | 简短提示词+单参考图=快速迭代流程 |
She is now holding an orange umbrella and smilingKeep the bottle silhouette, table, and lighting exactly as in the input.
Replace only the brand text on the label, from "ALPHA" to "AURA".
Same font weight, white on black, centered.Keep the person's face, pose, and clothing unchanged. Add a leather
shoulder bag, dark brown, hanging on the right shoulder.| 代码 | 含义 |
|---|---|
| 0 | 成功 |
| 64 | CLI参数错误 |
| 65 | 输入JSON格式错误/不匹配 |
| 69 | 上游服务5xx错误 |
| 75 | 可重试:超时/429请求过多 |
| 77 | 未登录或令牌被拒绝 |
runcomfy run blackforestlabs/flux-1-kontext/pro/edithttps://model-api.runcomfy.net/v1/models/blackforestlabs/flux-1-kontext/pro/edit.runcomfy.net.runcomfy.com--output-dirCtrl-Cruncomfy login~/.config/runcomfy/token.jsonRUNCOMFY_TOKEN--inputmodel-api.runcomfy.net*.runcomfy.net*.runcomfy.com