> ## Documentation Index
> Fetch the complete documentation index at: https://dripart-chore-sync-comfy-api-v2-spec-463e218.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Mage-Flow：ComfyUI 工作流示例

> Mage-Flow 是微软推出的紧凑型 4B 模型，用于在 ComfyUI 中进行文生图和基于指令的图像编辑，支持最高 2K 的原生分辨率。

**Mage-Flow** 是微软研究院推出的紧凑型 4B 规模生成式技术栈，用于高效的文生图和基于指令的图像编辑。该技术栈由两个协同设计的组件构成：[Mage-VAE](https://huggingface.co/microsoft/Mage-VAE)（一个轻量级高保真度 Latent tokenizer）和采用整流流匹配（rectified flow matching）训练的原生分辨率多模态扩散 Transformer（NR-MMDiT）。结合原生分辨率打包，该共享技术栈为两个模型实例提供支持：用于文生图的 Mage-Flow 和用于基于指令的图像编辑的 Mage-Flow-Edit。每个实例提供 Base、RL 对齐和 4 步 Turbo 三种变体。

Mage-Flow 支持每边 512 到 2048 像素的原生分辨率，并支持任意宽高比，包括 4:1 等极端尺寸。

**许可证**：[MIT](https://github.com/microsoft/Mage/blob/main/LICENSE)

**相关链接**：

* [Hugging Face：microsoft/Mage-Flow](https://huggingface.co/microsoft/Mage-Flow)
* [Hugging Face：Comfy-Org/Mage-Flow（ComfyUI 模型）](https://huggingface.co/Comfy-Org/Mage-Flow)
* [官方 GitHub 仓库](https://github.com/microsoft/Mage)
* [技术报告（arXiv）](https://arxiv.org/abs/2607.19064)

## Mage-Flow 文生图工作流

<img src="https://raw.githubusercontent.com/Comfy-Org/workflow_templates/main/output/Mage_flow.png" alt="Mage-Flow 文生图工作流输出" />

<CardGroup cols={2}>
  <Card title="在 Comfy Cloud 上运行" icon="cloud" href="https://cloud.comfy.org/?template=image_mage_flow_t2i_int8&utm_source=docs&utm_medium=referral&utm_campaign=mage-flow">
    在 Comfy Cloud 中打开
  </Card>

  <Card title="下载工作流" icon="download" href="https://github.com/Comfy-Org/workflow_templates/blob/main/templates/image_mage_flow_t2i_int8.json">
    下载 JSON 或在模板库中搜索 “Mage-Flow”
  </Card>
</CardGroup>

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

该工作流由以下几个部分组成：

1. **文生图（Mage-Flow）子图**：核心生成 pipeline，包含模型加载、提示词处理、原生分辨率 Latent 生成、采样和 VAE解码
2. **SaveImageAdvanced**：保存已生成的图像

<Card title="了解 Subgraph" icon="book-open" href="/zh/interface/features/subgraph">
  此工作流使用 Subgraph 节点进行模块化处理。请查阅 Subgraph 文档，了解如何自定义和扩展此工作流。
</Card>

### 一键生成

最简单的方式是：在子图中输入文本提示词，设置所需分辨率，然后点击 **执行提示词**。默认参数即可生成高质量图像，几乎无需额外配置。

### 使用工作流

1. **输入提示词**：在子图的提示词输入框中输入文本描述
2. **设置分辨率**：调整宽度和高度，以获得所需的输出尺寸。Mage-Flow 支持每边 512 至 2048 像素的原生分辨率。
3. **调整设置**：根据需要配置种子和负面提示词
4. **点击队列**：按 `Ctrl+Enter` 生成

## Mage-Flow text-to-image workflow

<img src="https://raw.githubusercontent.com/Comfy-Org/workflow_templates/main/output/Mage_flow.png" alt="Mage-Flow text-to-image workflow output" />

<CardGroup cols={2}>
  <Card title="Run on Comfy Cloud" icon="cloud" href="https://cloud.comfy.org/?template=image_mage_flow_t2i_int8&utm_source=docs&utm_medium=referral&utm_campaign=mage-flow">
    Open in Comfy Cloud
  </Card>

  <Card title="Download Workflow" icon="download" href="https://github.com/Comfy-Org/workflow_templates/blob/main/templates/image_mage_flow_t2i_int8.json">
    Download JSON or search "Mage-Flow" in Template Library
  </Card>
</CardGroup>

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

The workflow is organized into a few parts:

1. **Text to Image (Mage-Flow) subgraph**: the core generation pipeline, containing model loading, prompt handling, native-resolution latent generation, sampling, and VAE decode
2. **SaveImageAdvanced**: saves the generated image

<Card title="Learn about Subgraph" icon="book-open" href="/zh/interface/features/subgraph">
  This workflow uses Subgraph nodes for modular processing. Check out the Subgraph documentation to learn how to customize and extend the workflow.
</Card>

### Single-click generation

At its simplest, just enter a text prompt in the subgraph, set your desired resolution, and click **Queue Prompt**. The defaults produce a high-quality image with minimal configuration.

### Using the workflow

1. **Enter a prompt** — type a text description in the subgraph's prompt input
2. **Set resolution** — adjust width and height for your desired output size. Mage-Flow supports native resolutions from 512 to 2048 pixels per side.
3. **Adjust settings** — configure the seed and negative prompt as needed
4. **Click Queue** — press `Ctrl+Enter` to generate

## Mage-Flow-Edit image edit workflow

<img src="https://raw.githubusercontent.com/Comfy-Org/workflow_templates/main/output/Mage_flow_edit.png" alt="Mage-Flow-Edit image edit workflow output" />

<CardGroup cols={2}>
  <Card title="Run on Comfy Cloud" icon="cloud" href="https://cloud.comfy.org/?template=image_mage_flow_edit_int8&utm_source=docs&utm_medium=referral&utm_campaign=mage-flow">
    Open in Comfy Cloud
  </Card>

  <Card title="Download Workflow" icon="download" href="https://github.com/Comfy-Org/workflow_templates/blob/main/templates/image_mage_flow_edit_int8.json">
    Download JSON or search "Mage-Flow-Edit" in Template Library
  </Card>

  <Card title="Download Sample Image" icon="image" href="https://raw.githubusercontent.com/Comfy-Org/workflow_templates/main/input/calm_amid_ruin.png">
    Get the example input image for this workflow
  </Card>
</CardGroup>

The image edit workflow uses Mage-Flow-Edit, an instruction-based model that edits images using natural language descriptions. Upload one or more reference images and describe the desired edit.

The workflow is organized into a few parts:

1. **LoadImage**: upload your reference images (up to 3)
2. **Image Edit (Mage-Flow-Edit) subgraph**: the core editing pipeline containing model loading, reference image conditioning, prompt handling, and sampling
3. **ImageCompare**: a side-by-side comparison of the original and edited image
4. **SaveImage**: saves the edited output

### Using image edit

1. **Upload reference images** — use the **LoadImage** node to load the image you want to edit (up to 3 images)
2. **Enter your edit instruction** — type a text description of the edit you want to apply (e.g., "replace the background with a beach scene" or "turn this into a watercolor painting")
3. **Adjust settings** — configure resolution, seed, and other parameters
4. **Click Queue** — press `Ctrl+Enter` to generate

## Mage-Flow-Edit Turbo image edit workflow

<img src="https://raw.githubusercontent.com/Comfy-Org/workflow_templates/main/output/Mage_flow_edit_turbo.png" alt="Mage-Flow-Edit Turbo image edit workflow output" />

<CardGroup cols={2}>
  <Card title="Run on Comfy Cloud" icon="cloud" href="https://cloud.comfy.org/?template=image_mage_flow_edit_turbo_int8&utm_source=docs&utm_medium=referral&utm_campaign=mage-flow">
    Open in Comfy Cloud
  </Card>

  <Card title="Download Workflow" icon="download" href="https://github.com/Comfy-Org/workflow_templates/blob/main/templates/image_mage_flow_edit_turbo_int8.json">
    Download JSON or search "Mage-Flow-Edit Turbo" in Template Library
  </Card>

  <Card title="Download Sample Image" icon="image" href="https://raw.githubusercontent.com/Comfy-Org/workflow_templates/main/input/hot_air_balloons_rising.png">
    Get the example input image for this workflow
  </Card>
</CardGroup>

The Turbo variant of the edit workflow uses a distilled 4-step checkpoint for faster editing. The structure and controls match the base edit workflow but with reduced sampling steps.

### Model downloads

For local use, download the ComfyUI-optimized model files from [Comfy-Org/Mage-Flow](https://huggingface.co/Comfy-Org/Mage-Flow).

<CardGroup cols={3}>
  <Card title="Text Encoder" icon="download" href="https://huggingface.co/Comfy-Org/Mage-Flow/resolve/main/text_encoders/qwen3vl_4b_bf16.safetensors">
    qwen3vl\_4b\_bf16.safetensors: Qwen3VL-4B text encoder
  </Card>

  <Card title="VAE" icon="download" href="https://huggingface.co/Comfy-Org/Mage-Flow/resolve/main/vae/mage_flow_vae_bf16.safetensors">
    mage\_flow\_vae\_bf16.safetensors
  </Card>

  <Card title="Diffusion Model (Base Int8)" icon="download" href="https://huggingface.co/Comfy-Org/Mage-Flow/resolve/main/diffusion_models/mage_flow_int8_convrot.safetensors">
    mage\_flow\_int8\_convrot.safetensors: Base model used in the T2I workflow
  </Card>

  <Card title="Diffusion Model (Turbo Int8)" icon="download" href="https://huggingface.co/Comfy-Org/Mage-Flow/resolve/main/diffusion_models/mage_flow_turbo_int8_convrot.safetensors">
    mage\_flow\_turbo\_int8\_convrot.safetensors: Turbo model used in the Turbo T2I workflow
  </Card>

  <Card title="Diffusion Model (Edit Int8)" icon="download" href="https://huggingface.co/Comfy-Org/Mage-Flow/resolve/main/diffusion_models/mage_flow_edit_int8_convrot.safetensors">
    mage\_flow\_edit\_int8\_convrot.safetensors: Edit model used in the Edit workflow
  </Card>

  <Card title="Diffusion Model (Edit Turbo Int8)" icon="download" href="https://huggingface.co/Comfy-Org/Mage-Flow/resolve/main/diffusion_models/mage_flow_edit_turbo_int8_convrot.safetensors">
    mage\_flow\_edit\_turbo\_int8\_convrot.safetensors: Edit Turbo model used in the Edit Turbo workflow
  </Card>
</CardGroup>

Other model variants (BF16, FP8) are also available for users with different hardware configurations.

Place the files in the following directories:

```
📂 ComfyUI/
├── 📂 models/
│   ├── 📂 diffusion_models/
│   │   ├── mage_flow_int8_convrot.safetensors
│   │   ├── mage_flow_turbo_int8_convrot.safetensors
│   │   ├── mage_flow_edit_int8_convrot.safetensors
│   │   └── mage_flow_edit_turbo_int8_convrot.safetensors
│   ├── 📂 text_encoders/
│   │   └── qwen3vl_4b_bf16.safetensors
│   └── 📂 vae/
│       └── mage_flow_vae_bf16.safetensors
```
