Remove Background: Qwen Image 2.1
Remove image backgrounds with Qwen Image 2.1, which natively supports 2K output and RGBA transparency for direct transparent results. It takes 1 input image…
About
Remove image backgrounds with Qwen Image 2.1, which natively supports 2K output and RGBA transparency for direct transparent results. It takes 1 input image…
What you provide
- Reading the workflow
Runs in ComfyUI. This workflow can't run on this page. Download it and open it in ComfyUI.
Download WorkflowNo sample outputs for this workflow yet.
Inside the workflow
A read-only preview of the node graph. Open it in Comfy Cloud or download it to edit the nodes.
Loading the graph
Open full-size workflow previewFiles in this workflow
- Comfy Cloud
- Yes
- Author
- Author unavailable
Requires custom nodes
- Reading the workflow
Use this workflow from code
Generated from the workflow graph and inputs when possible; stored examples are shown otherwise. Review credentials and endpoints before running code, which may incur charges.
What you need
- Runs on
- Comfy Cloud
- Key
- COMFY_API_KEY
Needs a paid Cloud plan and credits.
# Python 3.10+: pip install comfy-sdk==0.4.0
import os
from comfy_sdk import Comfy
api_key = os.environ.get("COMFY_API_KEY", "").strip()
if not api_key: raise RuntimeError("Set COMFY_API_KEY")
os.environ.setdefault("COMFY_BASE_URL", "https://cloud.comfy.org")
client = Comfy(api_key=api_key)
workflow = client.workflows.from_json({
"461": {
"class_type": "SaveImageAdvanced",
"inputs": {
"filename_prefix": "Qwen_image_2.1",
"format": "png",
"format.bit_depth": "8-bit",
"format.input_color_space": "sRGB",
"images": [
"459:457",
0
]
},
"_meta": {
"title": "Save Image (Advanced)"
}
},
"470": {
"class_type": "LoadImage",
"inputs": {
"image": "angry_broccoli.png"
},
"_meta": {
"title": "Load Image"
}
},
"472": {
"class_type": "ImageCompare",
"inputs": {
"compare_view": None,
"image_a": [
"470",
0
],
"image_b": [
"461",
0
]
},
"_meta": {
"title": "Compare Images"
}
},
"459:451": {
"class_type": "UNETLoader",
"inputs": {
"unet_name": "qwen_image_2.1_int8_convrot.safetensors",
"weight_dtype": "default"
},
"_meta": {
"title": "Load Diffusion Model"
}
},
"459:453": {
"class_type": "CLIPLoader",
"inputs": {
"clip_name": "qwen3vl_8b_int8_convrot.safetensors",
"device": "default",
"type": "qwen_image"
},
"_meta": {
"title": "Load CLIP"
}
},
"459:454": {
"class_type": "VAELoader",
"inputs": {
"vae_name": "qwen_image_2.1_vae_bf16.safetensors"
},
"_meta": {
"title": "Load VAE"
}
},
"459:456": {
"class_type": "EmptyLatentImage",
"inputs": {
"batch_size": 1,
"height": 1024,
"width": 1024
},
"_meta": {
"title": "Empty Latent Image"
}
},
"459:457": {
"class_type": "VAEDecode",
"inputs": {
"samples": [
"459:458",
0
],
"vae": [
"459:454",
0
]
},
"_meta": {
"title": "VAE Decode"
}
},
"459:458": {
"class_type": "KSampler",
"inputs": {
"cfg": 1,
"denoise": 1,
"latent_image": [
"459:468",
0
],
"model": [
"459:469",
0
],
"negative": [
"459:474",
1
],
"positive": [
"459:474",
0
],
"sampler_name": "euler",
"scheduler": "simple",
"seed": 733114857276099,
"steps": 25
},
"_meta": {
"title": "KSampler"
}
},
"459:468": {
"class_type": "ComfySwitchNode",
"inputs": {
"on_false": [
"459:474",
2
],
"on_true": [
"459:456",
0
],
"switch": False
},
"_meta": {
"title": "If/Else Switch"
}
},
"459:469": {
"class_type": "QwenImage21Cache",
"inputs": {
"device": "auto",
"dtype": "default",
"model": [
"459:451",
0
]
},
"_meta": {
"title": "Qwen Image 2.1 Cache"
}
},
"459:474": {
"class_type": "TextEncodeQwenImage21",
"inputs": {
"clip": [
"459:453",
0
],
"images.image_1": [
"470",
0
],
"negative_prompt": "",
"prompt": "Remove the background, and output a PNG image",
"resolution": 0,
"vae": [
"459:454",
0
]
},
"_meta": {
"title": "Text Encode Qwen Image 2.1"
}
}
})
# run() also passes api_key to the partner nodes in this workflow.
job = client.run(workflow, api_key=api_key)