> ## Documentation Index
> Fetch the complete documentation index at: https://dripart-claude-comfy-concurrency-limits-page-s84u33.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Qwen-Image-2.1 ComfyUI 原生工作流示例

> 在 ComfyUI 中运行 Qwen-Image-2.1：一个模型即可完成图像生成与编辑，原生 2K 输出，专业级文字排版，并支持透明度通道。

**Qwen-Image-2.1** 是阿里 Qwen 团队 Qwen-Image 系列中最新发布的开放权重版本。单一模型同时涵盖文生图生成和基于指令的图像编辑，原生支持 2K 输出、专业排版，并具备用于透明背景的 alpha 通道。

**主要特性**：

* **生成与编辑合一**：同一套权重既可用于文生图提示词，也可用于编辑指令，因此工作流无需切换模型
* **原生 2K 输出**：直接生成最高 2048x2048 的图像，而无需对较小结果进行图像放大
* **专业排版**：密集的小号文字和复杂版式依然清晰，适用于信息图、幻灯片、UI 原型图、海报和包装设计
* **Alpha 通道支持**：VAE 携带四个通道，因此可以直接生成和编辑透明背景图像，而无需事后再进行抠图
* **多图像编辑**：参考图像按槽位顺序拼接到文本编码器中。Text Encode Qwen Image 2.1 节点最多接受 16 个槽位（`image_1` 到 `image_16`）；本页两个编辑模板接入了前 10 个（`image_1` 到 `image_10`）。`image_1` 是被编辑的图像，其余提供内容，因此提示词通过索引引用它们，例如 `image_1` 写作 `<image1>`
* **局部编辑**：描述要更改的对象或区域，图像的其余部分保持不变

**相关链接**：

* [GitHub 仓库](https://github.com/QwenLM/Qwen-Image)
* [Hugging Face（ComfyUI 模型）](https://huggingface.co/Comfy-Org/Qwen-Image-2.1)
* [Comfy 上的 Qwen Image 2.1](https://comfy.org/qwen-image-2.1/)

## Qwen-Image-2.1 工作流

<Tip>
  <Tabs>
    <Tab title="本地用户">
      请确保你的 ComfyUI 已经更新。

      * [ComfyUI 下载](https://www.comfy.org/download)
      * [ComfyUI 更新教程](/zh/installation/update_comfyui)

      本指南里的工作流可以在[工作流模板](/zh/interface/features/template)中找到。如果找不到，可能是 ComfyUI 没有更新。

      如果加载工作流时有节点缺失，可能原因有：

      1. 你用的不是最新版（每夜版）。
      2. 启动时有些节点导入失败。
    </Tab>

    <Tab title="云端用户">
      * [Cloud](https://cloud.comfy.org) 会在 ComfyUI 稳定版本发布后更新。

      所以，如果你发现本文档中有任何核心节点缺失，可能是因为新核心节点尚未在最新稳定版中发布。请等待下一个稳定版发布。
    </Tab>
  </Tabs>
</Tip>

<h3 id="image_qwen_image_2_1_t2i">
  Qwen Image 2.1 文本到图像
</h3>

根据您选择的宽高比和百万像素目标，从文本提示生成图像。

<img src="https://raw.githubusercontent.com/Comfy-Org/workflow_templates/main/templates/image_qwen_image_2_1_t2i-1.webp" alt="Qwen-Image-2.1 文本到图像工作流预览" />

<CardGroup cols={2}>
  <Card title="下载工作流" icon="download" href="https://github.com/Comfy-Org/workflow_templates/blob/main/templates/image_qwen_image_2_1_t2i.json">
    下载 JSON 或在模板库中搜索 “Qwen-Image-2.1”
  </Card>

  <Card title="在 Comfy Cloud 上运行" icon="cloud" href="https://cloud.comfy.org/?template=image_qwen_image_2_1_t2i&utm_source=docs&utm_medium=referral&utm_campaign=qwen-image-2-1">
    零设置在线运行 ComfyUI
  </Card>
</CardGroup>

**示例输出**

![Qwen-Image-2.1 文本到图像示例输出](https://raw.githubusercontent.com/Comfy-Org/workflow_templates/main/output/image_qwen_image_2_1_t2i.png)

<h3 id="image_qwen_image_2_1_image_edit">
  Qwen Image 2.1 图像编辑
</h3>

使用指令编辑图像。当编辑需要源图像中不存在的内容时，添加参考图像，例如将第二张照片中的服装穿到第一张照片中的人物身上。

<img src="https://raw.githubusercontent.com/Comfy-Org/workflow_templates/main/templates/image_qwen_image_2_1_image_edit-1.webp" alt="Qwen-Image-2.1 图像编辑工作流预览" />

<CardGroup cols={2}>
  <Card title="下载工作流" icon="download" href="https://github.com/Comfy-Org/workflow_templates/blob/main/templates/image_qwen_image_2_1_image_edit.json">
    下载 JSON 或在模板库中搜索 “Qwen-Image-2.1”
  </Card>

  <Card title="在 Comfy Cloud 上运行" icon="cloud" href="https://cloud.comfy.org/?template=image_qwen_image_2_1_image_edit&utm_source=docs&utm_medium=referral&utm_campaign=qwen-image-2-1">
    零设置在线运行 ComfyUI
  </Card>
</CardGroup>

**输入材料**

将这些文件上传到匹配的 `LoadImage` 节点：

<CardGroup cols={2}>
  <Card title="portrait_model_denim.png" icon="image" href="https://raw.githubusercontent.com/Comfy-Org/workflow_templates/main/input/portrait_model_denim.png">
    `LoadImage` 节点 470 · `portrait_model_denim.png`
  </Card>

  <Card title="clothing_light_blue_denim_shirt.png" icon="image" href="https://raw.githubusercontent.com/Comfy-Org/workflow_templates/main/input/clothing_light_blue_denim_shirt.png">
    `LoadImage` 节点 475 · `clothing_light_blue_denim_shirt.png`
  </Card>
</CardGroup>

**示例输出**

<div style={{display: 'grid', gridTemplateColumns: 'repeat(2, minmax(0, 1fr))', gap: '1rem', alignItems: 'start'}}>
  <img src="https://raw.githubusercontent.com/Comfy-Org/workflow_templates/main/input/portrait_model_denim.png" alt="输入图像" style={{width: '100%', height: 'auto', objectFit: 'contain'}} />

  <img src="https://raw.githubusercontent.com/Comfy-Org/workflow_templates/main/output/image_qwen_image_2_1_image_edit.png" alt="Qwen-Image-2.1 图像编辑示例输出" style={{width: '100%', height: 'auto', objectFit: 'contain'}} />
</div>

<h3 id="image_qwen_image_2_1_background_removal">
  移除背景：Qwen Image 2.1
</h3>

使用编辑指令移除照片的背景。该工作流复用图像编辑子图，提示词为 `Remove the background, and output a PNG image`，并将结果与原始图像进行对比。

<img src="https://raw.githubusercontent.com/Comfy-Org/workflow_templates/main/templates/image_qwen_image_2_1_background_removal-1.webp" alt="Qwen-Image-2.1 移除背景工作流预览" />

<CardGroup cols={2}>
  <Card title="下载工作流" icon="download" href="https://github.com/Comfy-Org/workflow_templates/blob/main/templates/image_qwen_image_2_1_background_removal.json">
    下载 JSON 或在模板库中搜索 “Qwen-Image-2.1”
  </Card>

  <Card title="在 Comfy Cloud 上运行" icon="cloud" href="https://cloud.comfy.org/?template=image_qwen_image_2_1_background_removal&utm_source=docs&utm_medium=referral&utm_campaign=qwen-image-2-1">
    零设置在线运行 ComfyUI
  </Card>
</CardGroup>

**输入材料**

将此文件上传到匹配的 `LoadImage` 节点：

<Card title="angry_broccoli.png" icon="image" href="https://raw.githubusercontent.com/Comfy-Org/workflow_templates/main/input/angry_broccoli.png">
  `LoadImage` 节点 470 · `angry_broccoli.png`
</Card>

## 模型下载

三个工作流共用相同的扩散模型、VAE 和基础文本编码器。文生图和图像编辑模板各自额外加载一个提示词增强文本编码器：文生图为 `qwen3.5_9b_qwen_image_2.1_pe_t2i`，图像编辑为 `qwen3.5_9b_qwen_image_2.1_pe_i2i`。

**text\_encoders**

* [qwen3vl\_8b\_int8\_convrot.safetensors](https://huggingface.co/Comfy-Org/Qwen-Image-2.1/blob/main/text_encoders/qwen3vl_8b_int8_convrot.safetensors)（模板默认加载，内存占用更低）
* [qwen3vl\_8b\_bf16.safetensors](https://huggingface.co/Comfy-Org/Qwen-Image-2.1/blob/main/text_encoders/qwen3vl_8b_bf16.safetensors)（完整精度，需要更多内存）
* [qwen3.5\_9b\_qwen\_image\_2.1\_pe\_t2i.int8\_convrot.safetensors](https://huggingface.co/Comfy-Org/Qwen-Image-2.1/blob/main/text_encoders/qwen3.5_9b_qwen_image_2.1_pe_t2i.int8_convrot.safetensors)（文生图模板的提示词增强）
* [qwen3.5\_9b\_qwen\_image\_2.1\_pe\_i2i.int8\_convrot.safetensors](https://huggingface.co/Comfy-Org/Qwen-Image-2.1/blob/main/text_encoders/qwen3.5_9b_qwen_image_2.1_pe_i2i.int8_convrot.safetensors)（图像编辑模板的提示词增强）

**diffusion\_models**

* [qwen\_image\_2.1\_int8\_convrot.safetensors](https://huggingface.co/Comfy-Org/Qwen-Image-2.1/blob/main/diffusion_models/qwen_image_2.1_int8_convrot.safetensors)（模板默认加载，内存占用更低）
* [qwen\_image\_2.1\_bf16.safetensors](https://huggingface.co/Comfy-Org/Qwen-Image-2.1/blob/main/diffusion_models/qwen_image_2.1_bf16.safetensors)（完整精度，需要更多内存）

**vae**

* [qwen\_image\_2.1\_vae\_bf16.safetensors](https://huggingface.co/Comfy-Org/Qwen-Image-2.1/blob/main/vae/qwen_image_2.1_vae_bf16.safetensors)

**模型保存位置**

```
📂 ComfyUI/
├── 📂 models/
│   ├── 📂 text_encoders/
│   │      ├── qwen3vl_8b_int8_convrot.safetensors
│   │      ├── qwen3vl_8b_bf16.safetensors
│   │      ├── qwen3.5_9b_qwen_image_2.1_pe_t2i.int8_convrot.safetensors
│   │      └── qwen3.5_9b_qwen_image_2.1_pe_i2i.int8_convrot.safetensors
│   ├── 📂 diffusion_models/
│   │      ├── qwen_image_2.1_int8_convrot.safetensors
│   │      └── qwen_image_2.1_bf16.safetensors
│   └── 📂 vae/
│          └── qwen_image_2.1_vae_bf16.safetensors
```

## 工作流设置

### Sampler 设置

三个工作流均使用 `steps` 25、`cfg` 1、`euler` sampler 和 `simple` scheduler 进行采样。

当 `cfg` 为 1 时，ComfyUI 会跳过负向条件的计算，因此在这些工作流中负向提示词不起作用。模板保持 `cfg` 1，这是 Qwen-Image-2.1 发布时所对应的路径；只有当你希望负向提示词生效时才调高它。`cfg` 2 能更紧密地遵循复杂提示词（包括小字号文本和数字），代价是边缘过度锐化。再往上调会让画面偏亮或偏暗，`cfg` 5 会严重降低质量，`cfg` 0.5 会破坏图像。请一次只改一个取值，并在固定种子下进行比较。

`steps` 是第二个可调项。Qwen-Image-2.1 发布的推理流程使用 `euler` sampler 和约 40 到 50 步，而模板从更低的 25 开始。简单的局部编辑在 4 到 8 步就能成立，因此像把某件衣服换成另一种颜色这类请求比默认设置快好几倍；而重写整幅画面的编辑会失去一致性，需要完整的 25 步。手部、手指这类难处理的细节大约在 30 步时收敛，而从 25 步提到 40 步可以减少细节区域的杂乱噪点。只有在某个具体细节始终无法收敛时才调整 `steps`。

### 分辨率

**文本到图像**：**分辨率选择器**节点设置宽高比和百万像素目标，其中 1.0 MP 约为 1024x1024。Qwen-Image-2.1 原生生成 2K 图像，因此对于 2048x2048 的方形输出，将目标设置为约 4.0 MP。

**图像编辑**：画布由 Image Edit 子图节点上的 `resolution` 控件决定（范围 `0` 到 `4096`，步长 `32`）。节点自身默认为 `1024`，模板给的是 `0`。当 `custom_size` 关闭时（模板默认设置），编辑在首张参考图 `image_1` 的尺寸下生成：

* `resolution` 为 `0` 时每张参考图保持自身像素尺寸，并四舍五入到 32 的倍数，因此 3000x4000 的照片会得到 3008x4000 的画布
* `resolution` 大于 `0` 时，将 `image_1` 的宽高比缩放至 `resolution` x `resolution` 的像素预算，这是总像素数而非宽或高，并四舍五入到 32 的倍数，因此同一张照片在 `resolution` 为 `1024` 时约为 896x1184

开启 `custom_size` 则改用**分辨率选择器**提供的画布，并尽量接近调整后的 `image_1` 尺寸，否则编辑可能偏移。

决定开销的是画布尺寸：3000x4000 的参考图在 `resolution` 为 0 时按 3008x4000（约 12 MP）采样，同一次编辑在 `resolution` 1024 时按约 896x1184（约 1 MP）采样。在 RTX 5090 上分别是约 6 s/it 和约 0.3 s/it。降低 `resolution` 是通过生成更小的结果提速，并不会增加细节。如果编辑感觉很慢，先检查 `resolution` 和参考图像的像素尺寸，再考虑改动其它参数。多张较大的参考图像会进一步拖慢编辑，下方的 KV 缓存设置会影响这部分开销。另外，远超模型 2K 训练尺寸的目标（例如 4K）会降低提示词遵循度。

### 图像编辑提示

参考图像按插槽顺序拼接到文本编码器中，提示词通过索引指向每张图像：

```
Keep the character and pose in <image1> unchanged, put this light blue denim shirt from <image2> on the character, preserve the original facial features, hair, body shape and pose
```

要让编辑只作用于某个区域，可以先把该区域标在图像上。在提供 `image_1` 的 `LoadImage` 节点（节点 470：右键点击节点，选择**用遮罩编辑器打开**）上用 **Paint Pen** 涂抹该区域后保存。Paint Pen 画在图像的 RGB 图层上，不会写入遮罩，因此保存会把带标记的图像写回节点，标记也成为这次编辑读取的参考图的一部分。在提示词中指名标记的颜色，就能把指令指向该区域，例如“把红色区域里的夹克换掉”。标记要限制在需要修改的区域内；如果标记的颜色出现在结果里，就在提示词中一并写明你想要的颜色。

### KV 缓存

编辑工作流包含 **Qwen Image 2.1 Cache** 节点，用于在采样步骤之间保留缓存的文本与参考前缀。模板默认设置适用于大多数情况。

该节点为实验性功能，提供两个控件：

| 控件 | 取值 | 作用 |
| - | - | - |
| `device` | `auto`（默认）、`gpu`、`cpu`、`off` | `auto` 先使用空闲的 VRAM，再使用 RAM。`cpu`（RAM）会在计算背后预取，速度损失很小。`off` 每步重新计算前缀，速度更慢，但在排查问题时可排除缓存因素 |
| `dtype` | `default`（默认）、`int8`、`int4` | 存储精度。`default` 无损。`int8` 把缓存减半，精度约等于 bf16；`int4` 将缓存降到四分之一，但每步误差大约翻倍 |

### 提示词增强

文生图和图像编辑模板包含一个可选的提示词增强步骤。它使用独立的文本编码器在采样前改写提示词，把简短的请求扩展为更详细的描述。

两个模板都在 Qwen Image 2.1 子图节点上提供以下控件：

* `refine_prompt`：两个模板默认都关闭。开启后图像模型使用改写后的提示词采样，而不是你输入的原始提示词
* `PE_model`：执行改写的文本编码器，文生图为 `qwen3.5_9b_qwen_image_2.1_pe_t2i.int8_convrot.safetensors`，图像编辑为 `qwen3.5_9b_qwen_image_2.1_pe_i2i.int8_convrot.safetensors`
* `thinking_mode`：两个模板默认都关闭。与 `refine_prompt` 一起开启后，改写模型会在输出前先进行推理

子图内的 **Preview Any** 节点会显示真正送入图像模型的提示词，方便你在决定是否保留改写结果前先查看。改写模型遵循的指令位于 **Text (System Prompt)** 节点中，可以自行编辑。由于只有开启 `refine_prompt` 时才会执行增强分支，两个模板中的增强文本编码器都是可选的；需要时开启 `refine_prompt` 即可。背景移除模板不包含此步骤。


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.