Skip to content
GenLovers

How to Set Up Qwen-Image-2.1 in ComfyUI

Last updated: 12 min readDifficulty: Beginner

Written by Clement

A promotional image reading QWEN-IMAGE 2.1, NO FILTER SETUP, NO COMFYUI NEEDED beside a stylized portrait, for the Qwen-Image-2.1 ComfyUI setup guide.

Qwen-Image-2.1 is Alibaba's open-weight image model, covering text-to-image generation, multi-reference image editing (up to 16 input images in one call), native transparent-background (RGBA) output, and a dedicated background-removal mode. This guide's setup script installs all three capabilities in one command, and pairs them with a simple three-tab web interface built for this guide, no ComfyUI experience required. Everything runs on a GPU you rent by the hour rather than a hosted API, so there's no account gate, no content filter, and no per-generation charge once it's running.

1 steps

Watch the video walkthrough

  1. 1

    Step 1 of 24

    Prefer video?

    This guide has a companion video covering the same setup end to end, from picking a GPU through generating with all three tabs.

    Watch on YouTube
    The full walkthrough below, screenshot by screenshot. Watch on YouTube

2 steps

Create a RunPod account

  1. 2

    Step 2 of 24

    Sign up at RunPod

    Go to runpod.io and create an account (this is a referral link).

    Open runpod.io
    RunPod homepage with the Sign Up button in the top navigation circled.
    Click on the signup button on the top right to start Open runpod.io
  2. 3

    Step 3 of 24

    Add funds to your account

    $10 covers a solid testing session with the default int8 setup.

    The int8 diffusion model and text encoder together are about 13.6GB, so most of your pod time goes to generation, not downloading.

    RunPod dashboard top-right corner with the add-funds plus button circled.
    The + button next to your balance, top right of the dashboard.

6 steps

Configure and deploy the pod

Pick your GPU based on the weight tier from the callout above: 12GB+ for the int8 default, 24GB+ for --full, 8-10GB+ for --gguf.

  1. 4

    Step 4 of 24

    Pick a GPU that clears your chosen tier's VRAM floor

    From the dashboard, click Pods in the left nav, then Deploy Pod.

    Sort by VRAM and price.

    RunPod GPU instance list with a GPU's price and VRAM circled.
    The GPU list, sorted by VRAM, RAM, vCPU, and hourly price.
  2. 5

    Step 5 of 24

    Set the pod template to a PyTorch build

    Runpod Pytorch is the current default template; it ships CUDA and PyTorch pre-installed.

    If a different template is selected, hit Change template and pick it from the list.

  3. 6

    Step 6 of 24

    Expose the ports ComfyUI needs

    Under Expose HTTP ports, set 8888,4000,8188,8889.

    8188 is ComfyUI's default port, 8888 is Jupyter, and 8889 is where the optional Gradio UI further down this guide runs if you use it.

  4. 7

    Step 7 of 24

    Set container disk to at least 40GB (60GB if using --full)

    The int8 and GGUF tiers fit comfortably in 40GB alongside ComfyUI and its Python environment; the bf16 tier needs more headroom.

  5. 8

    Step 8 of 24

    Attach a network volume instead of relying on container disk alone

    A network volume survives stopping the pod; container disk doesn't.

    The model download (13.6GB+ depending on tier) is one you don't want to repeat every time you redeploy onto fresh container disk. Attach a 40GB+ network volume, mount it at /workspace, and the download happens once.

  6. 9

    Step 9 of 24

    Deploy On-Demand

    On-Demand bills per second of actual usage, no upfront commitment, right for testing before you know how much you'll use this.

    RunPod's Deploy Pod screen with an RTX PRO 4000 GPU selected at $0.57/hr, container disk and a qwen-image-2-1-setup-test network volume mounted at /workspace, and the Deploy Pod button.
    The pod deployed for this guide's test run: RTX PRO 4000, $0.57/hr, network volume mounted at /workspace.

4 steps

Run the setup script in Jupyter

  1. 10

    Step 10 of 24

    Open Jupyter Lab

    On the pod's Connect tab, port 8888 shows "Jupyter Lab, Ready." Click it.

  2. 11

    Step 11 of 24

    Download the setup script

    Grab setup_qwen_image_2_1_comfyui.py below and save it locally.

    Download the setup script (.py)
  3. 12

    Step 12 of 24

    Upload the setup script

    In Jupyter, upload the file you just downloaded into /workspace.

  4. 13

    Step 13 of 24

    Open a terminal and run the script

    python setup_qwen_image_2_1_comfyui.py for the int8 default.

    Add --full for bf16, or --gguf for the Q4_K_M quantized model. It clones ComfyUI and downloads the diffusion model, text encoder, and VAE for your chosen tier.

    JupyterLab file browser showing setup_qwen_image_2_1_comfyui.py and qwen_image_2_1_gradio.py uploaded to /workspace, with a terminal below running the install and downloading ComfyUI's Python dependencies.
    The setup script mid-install in a Jupyter terminal, pulling ComfyUI's dependencies over pip.

5 steps

Open ComfyUI and load a workflow

  1. 14

    Step 14 of 24

    Go back to the pod's Connect tab in RunPod

    Same screen you used to open Jupyter.

  2. 15

    Step 15 of 24

    Open port 8188

    That's ComfyUI's default port, already exposed from the pod-template step above.

    Click it once the setup script finishes.

  3. 16

    Step 16 of 24

    Close the pop-ups

    ComfyUI opens with a couple of dialogs on top.

    Close them to get to the empty canvas.

  4. 17

    Step 17 of 24

    Open the Templates sidebar and search "qwen image 2.1"

    Three official Comfy-Org templates appear: Qwen Image 2.1: Text to Image, Qwen Image 2.1: Image Edit, and Remove Background: Qwen Image 2.1.

    Pick the one matching what you want to do.

  5. 18

    Step 18 of 24

    Point each model loader at your downloaded files

    If a node shows a red missing-model error, press R to refresh the models list, then select your diffusion model, text encoder, and qwen_image_2.1_vae_bf16.safetensors in their respective loader nodes.

Get new guides by email

One email when we publish new guides and model breakdowns. No spam, unsubscribe anytime.

Text-to-image: the parameters that matter

The Text to Image template exposes a resolution selector (aspect ratio plus a megapixel target, default 1.0), positive and negative prompt boxes, and the usual sampler settings. CFG defaults to 1.0; ComfyUI's own node tooltip on TextEncodeQwenImage21 notes that reference images are resized to fit the resolution target while preserving aspect ratio, at multiples of 32 pixels, so an odd input size gets rounded rather than rejected.

For image editing, the same text encoder node accepts an Autogrow list of reference images, image_1 through image_16, capped at 16 slots in ComfyUI's own source rather than the 10 sometimes quoted elsewhere. The official Image Edit template ships with 2 image inputs wired by default; add more by connecting additional Load Image nodes into the empty image_N slots on the text encoder node.

The Gradio Text to Image tab, empty state, with prompt and negative-prompt boxes, width/height sliders defaulted to 1024x1024, steps at 25, CFG at 1, and a Generate button.
The same text-to-image controls, without the node graph: the Gradio app's Text to Image tab.
AI-generated photorealistic image of a woman with short auburn hair sitting at a wooden cafe table by a rain-streaked window, holding a ceramic mug with both hands.
Text-to-image output from this guide's test run, default int8 tier, 25 steps.
AI-generated photorealistic image of a man wearing a white t-shirt with a two-color gradient logo printed across the chest, standing in a sunlit loft apartment.
Same run, same tier: legible logo text and gradient direction on the first attempt.
The Gradio Image Edit tab with two reference images loaded (the logo-shirt man and the cafe-scene woman) and a prompt naming which image is which, ready to generate.
Two reference images loaded on the Image Edit tab, with the prompt naming each one explicitly.
AI-generated image combining the cafe-scene woman's face and pose with the logo t-shirt from the other reference image, keeping the cafe background and lighting.
The multi-reference edit output: the cafe woman's face and pose, wearing the logo shirt from the second reference.

Weight tiers and hardware

Pick one tier before running the setup script; VRAM figures are the practical floor for that tier, not a hard vendor-published minimum.

int8 (default)
~7.3GB diffusion model (qwen_image_2.1_int8_convrot.safetensors) + ~6.3GB text encoder (qwen3vl_8b_w4a8.safetensors). 12GB+ VRAM.
bf16 (--full)
~14.2GB diffusion model (qwen_image_2.1_bf16.safetensors) + ~17.5GB text encoder (qwen3vl_8b_bf16.safetensors). 24GB+ VRAM, closest to reference quality.
GGUF (--gguf)
~4.2GB Q4_K_M quantized diffusion model, via city96's ComfyUI-GGUF custom node (installed automatically). Paired with the int8 text encoder. 8-10GB VRAM.
VAE
qwen_image_2.1_vae_bf16.safetensors, ~676MB, shared across all three tiers.
Container disk
40GB minimum; 60GB if using --full.

Background removal and transparency

The Remove Background: Qwen Image 2.1 template uses the same model with a prompt built for extraction (e.g. "remove the background, keep only the subject, output a PNG") and saves a PNG with an alpha channel intact - this is the RGBA support the base model is tagged with on Hugging Face, not a separate matting model bolted on afterward.

The Gradio Remove Background tab, showing the original logo-shirt photo on the left and the transparent-PNG result with a checkerboard alpha background on the right.
Original next to the transparent-PNG result on the Gradio app's Remove Background tab.

3 steps

Adding a LoRA

Follow along

The logo t-shirt subject cut out onto a transparent background, alpha channel intact.
The same subject, extracted with real alpha-channel transparency rather than a green-screen key.
  1. 19

    Step 19 of 24

    Place LoRA files in the loras folder

    The setup script creates ComfyUI/models/loras/ during install.

    Drop any Qwen-Image-2.1-compatible .safetensors LoRA there.

  2. 20

    Step 20 of 24

    Add a Load LoRA node between the model loader and the sampler

    Expand the workflow's internal sub-graph (the node-group expansion button, top-right of the compact group), double-click the canvas, search Load LoRA, and wire its MODEL and CLIP outputs into the path the diffusion model and text encoder originally fed directly.

  3. 21

    Step 21 of 24

    Set the LoRA strength

    Start around 0.8-1.0 and adjust from there; too high a strength on an image LoRA tends to distort anatomy and composition before it improves style fidelity.

3 steps

Skip the node graph: a simple Gradio UI

This is the part most Qwen-Image-2.1 setup guides don't give you. You don't need to know what a node graph is, or ever open ComfyUI's canvas, to use any of this. Pass the same one-line setup script an extra file and it starts a small web app alongside ComfyUI automatically, talking to ComfyUI's API in the background so you never see it. Three plain tabs: a prompt box for text-to-image, an image-upload box plus prompt for editing, and a one-click background remover. On the Image Edit tab, the file picker takes multiple images in one selection, and selecting again adds more rather than replacing what's already there - use Clear all reference images to start over.

  1. 22

    Step 22 of 24

    Download the Gradio app before you run --serve

    Grab qwen_image_2_1_gradio.py below and upload it into /workspace, right next to setup_qwen_image_2_1_comfyui.py.

    The setup script looks for it in its own folder and launches it for you if it's there.

    Download the Gradio app (.py)
  2. 23

    Step 23 of 24

    Run the setup script's --install step as normal

    python setup_qwen_image_2_1_comfyui.py --install.

    If the Gradio file is present, this also installs gradio, requests, and pillow alongside ComfyUI's own dependencies.

  3. 24

    Step 24 of 24

    Run --serve as normal

    python setup_qwen_image_2_1_comfyui.py --serve.

    It starts ComfyUI, waits for it to answer, then starts the Gradio UI on top of it automatically on port 8889, already in the Expose HTTP ports list from the pod-template step above, so there's nothing extra to expose. Open port 8889 from the pod's Connect tab for the plain UI, or 8188 for the ComfyUI node graph - both are running at once.

What we tested

Real numbers from our own run, not vendor-quoted figures: RunPod RTX PRO 4000 Blackwell (24GB usable VRAM), EU-RO-1, secure cloud, $0.57/hr, int8 default, Text to Image template at the framework's 1024x1280 portrait resolution.

Install time
About 4 minutes for the ~13.6GB int8 diffusion model + text encoder + VAE combined, over aria2c's multi-connection downloads
First generation
About 50 seconds total: a one-time ~49s CUDA warm-up on the first sampling step, then roughly 1.8s per step for the remaining 24 of 25 steps
Repeat generations
About 45 seconds each (25 steps at ~1.8s/step, no repeated warm-up once the model is loaded)
Quality, text/logo rendering
Strong: a branded t-shirt logo with a two-color gradient came out fully legible with the correct colors on the first attempt
Quality, fine skin-level detail
Mixed: a small forehead tattoo rendered as a plain outline rather than the requested detailed logo+text combination; a chest tattoo's text was present but slightly rough at full zoom
NSFW capability
Not filtered. Generated erotic and explicit test content without refusal or a content-policy block, since this runs entirely on your own rented hardware rather than through a hosted API

Troubleshooting

Out-of-memory error

Drop to a smaller tier (bf16 to int8 to GGUF), lower the resolution target, or move to a GPU with more VRAM

Node shows red / missing model

Press R in ComfyUI to refresh the models list after the setup script finishes; confirm the file landed in the exact folder the loader node expects (diffusion_models/, text_encoders/, or vae/)

GGUF node not found

Confirm the setup script ran with --gguf (it clones city96/ComfyUI-GGUF only in that mode); if you switched tiers after an earlier --install, re-run with --gguf to pull the custom node

Reference image in an edit workflow gets ignored

Confirm its Load Image node's IMAGE output is actually wired into an image_N slot on the TextEncodeQwenImage21 node, not left disconnected from an earlier edit

Gradio Image Edit ignores your uploaded photos and generates unrelated people

Re-download qwen_image_2_1_gradio.py - an earlier version submitted the reference images in a shape ComfyUI's server silently ignores, so the result came from the prompt alone with no images attached. Fixed as of this guide's current version; re-upload the file to /workspace and restart the app if you downloaded it before this fix

Gradio Image Edit with 2+ images only shows ONE of the people, output ignores the other reference entirely

Re-download qwen_image_2_1_gradio.py - an earlier version uploaded every reference image under the same fixed filename with overwrite enabled, so the second upload silently replaced the first one on disk before generation ran, and both LoadImage nodes ended up pointing at one single file. Fixed as of this guide's current version (each upload now gets a unique name); re-upload the file to /workspace and restart the app if you downloaded it before this fix

Output has no transparency where expected

Confirm you're on the Remove Background template (or a workflow that explicitly asks for a transparent/PNG output in the prompt) - the plain Text to Image template does not produce alpha by default

Gradio UI didn't start with --serve

Confirm qwen_image_2_1_gradio.py is in the same folder as the setup script (check the terminal for a SKIP Gradio UI line) and that you didn't pass --no-gradio; its own log is at /workspace/gradio_stdout.log

Gradio app can't reach ComfyUI

Check /workspace/comfyui_stdout.log for a crash; the setup script waits up to 180s for ComfyUI to answer before starting Gradio, so a slow model load can outrun that window on a first run

Frequently asked questions

What is Qwen-Image-2.1?
Qwen-Image-2.1 is an open-weight image model from Alibaba's Qwen team, covering text-to-image generation, multi-reference image editing (up to 16 input images per call), native transparent-background PNG output, and a dedicated background-removal workflow.
What does this guide add beyond a normal ComfyUI setup walkthrough?
A single setup script that installs all three capabilities at once, no manual file placement, plus an optional plain web interface built for this guide specifically, so someone who has never opened ComfyUI's node graph can still run text-to-image, multi-reference editing, and background removal. It also runs on a rented GPU rather than a hosted API, so there's no account gate, no content filter, and no per-generation fee once it's set up.
Can I use Qwen-Image-2.1 commercially?
Not under the standard license. The model's weights ship under the Qwen RESEARCH LICENSE AGREEMENT, non-commercial use only, with no separate carve-out for generated outputs. This differs from the earlier Qwen-Image and Qwen-Image-Edit models, which are Apache 2.0. Commercial use requires a separate license directly from Qwen.
How many reference images can I use for editing?
Up to 16, per the image_1 through image_16 slots on ComfyUI's own TextEncodeQwenImage21 node. The official Image Edit template ships with 2 wired by default; add more by connecting additional Load Image nodes.
Do I need a GPU to run Qwen-Image-2.1 locally?
Yes. The lightest supported path here is the GGUF Q4_K_M tier at roughly 8-10GB VRAM; the int8 default needs 12GB+, and the bf16 originals need 24GB+.
What's the difference between the int8, bf16, and GGUF versions?
They're the same model at different precision/quantization levels. bf16 is the full-precision original (largest, closest to reference quality). int8 is Comfy-Org's own quantized repackage (roughly half the size). GGUF (via city96's ComfyUI-GGUF node) goes further for the lowest-VRAM GPUs, at some quality cost.
Does the background-removal workflow use a different model?
No. It's the same Qwen-Image-2.1 weights with a prompt built for extraction, saving a PNG with an alpha channel - which lines up with the base model's own "rgba" tag on Hugging Face rather than a separate matting model.
Can I use Qwen-Image-2.1 without touching ComfyUI's node graph?
Yes. Upload the Gradio app linked in this guide next to the setup script before running --serve, and it starts automatically alongside ComfyUI: a plain prompt box, an image-upload box for editing, and a one-click background remover, with no nodes visible. It calls ComfyUI's own API in the background, so ComfyUI still has to be running.

Keep reading

Related models

Get new guides by email

One email when we publish new guides and model breakdowns. No spam, unsubscribe anytime.

Add GenLovers as a preferred source in Google