> ## Documentation Index
> Fetch the complete documentation index at: https://docs.comfy.org/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 携带四个通道，因此可以直接生成和编辑透明背景图像，而无需事后再进行抠图
* **多图像编辑**：参考图像按槽位顺序拼接到文本编码器中。节点提供 `image_1` 到 `image_16` 槽位，提示词通过索引引用它们，例如 `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/Qwen_image_2.1.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>

## 模型下载

两个工作流加载相同的文件。两个模板默认都使用 int8 版本的扩散模型。

**text\_encoders**

* [qwen3vl\_8b\_bf16.safetensors](https://huggingface.co/Comfy-Org/Qwen-Image-2.1/blob/main/text_encoders/qwen3vl_8b_bf16.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_bf16.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 进行采样。文本到图像工作流保持种子固定，而图像编辑工作流则将其随机化。

### 分辨率

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

**图像编辑**：当 `custom_size` 关闭时（这是模板默认设置），输出会遵循 `image_1` 的宽高比，缩放为约 `resolution` x `resolution` 像素（默认 1024，四舍五入到 32 的倍数）。这不是 `image_1` 的原始像素尺寸。将 `resolution` 设为 0 以让每个参考图像保持其自身尺寸，并四舍五入到 32 的倍数。开启 `custom_size` 以改用**分辨率选择器**画布，并使其接近调整大小后的 `image_1` 尺寸，否则编辑可能会偏移。

### 图像编辑提示

参考图像按插槽顺序拼接到文本编码器中，提示词通过索引来指向每个图像。模板提示词是该模式的良好示例：

```
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
```

### KV 缓存

图像编辑工作流包含 **Qwen Image 2.1 Cache** 节点，它设置缓存的文本和参考前缀所在的位置：

| 设置       | 值                            | 效果                                                                                  |
| -------- | ---------------------------- | ----------------------------------------------------------------------------------- |
| `device` | `auto`（默认）、`gpu`、`cpu`、`off` | `auto` 使用空闲的 VRAM，然后使用 RAM。`cpu` 在计算后台预取，对速度影响很小。`off` 每一步都重新计算前缀，这较慢，但在调试时可以排除缓存问题 |
| `dtype`  | `default`（默认）、`int8`、`int4`  | 存储精度。`default` 是无损的，`int8` 将缓存减半且精度约与 bf16 相当，`int4` 将其减为四分之一，但每一步的误差大约翻倍           |
