Qwen-Image InstantX Union ControlNet
Generate images with Qwen-Image InstantX ControlNet, supporting canny, soft edge, depth, pose
简介
The Qwen-Image InstantX Union ControlNet workflow is designed to generate high-quality images using the Qwen-Image model with advanced ControlNet capabilities. This workflow integrates multiple control techniques such as canny edge detection, soft edge, depth, and pose estimation to offer fine-grained control over the image generation process.
By leveraging these techniques, users can create images that adhere closely to specific visual constraints or stylistic guidelines. Technically, the workflow utilizes a combination of nodes including SaveImage, LoadImage, and PreviewImage to handle image data, while specialized nodes like 0e306186-0dda-4b49-bfcb-98cab32901d9 and f8e756aa-94b4-4c02-943d-2e7910344622 are used to apply the ControlNet transformations. The FluxKontextImageScale node further refines the scaling of images, ensuring that the output maintains high fidelity to the input parameters.
你需要提供
- 正在读取工作流
在 ComfyUI 中运行。 此工作流无法在本页面运行。你可以在 Comfy Cloud 中打开(已预先加载所需内容),或下载后在自己的 ComfyUI 中使用。
在 Cloud 中试用查看工作流内部
节点图的只读预览。在 Comfy Cloud 中打开或下载后即可编辑节点。
Loading the graph
Open full-size workflow preview- 作者
- ComfyUI
需要自定义节点
- 正在读取工作流
通过代码使用此工作流
尽可能根据工作流图和输入自动生成代码,否则显示已保存的示例。运行代码可能产生费用,请先核对凭据和端点。
What you need
- Runs on
- Comfy Cloud
- 密钥
- COMFY_API_KEY
需要付费的 Cloud 方案和额度。
# 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({
"60": {
"class_type": "SaveImage",
"inputs": {
"filename_prefix": "ComfyUI",
"images": [
"111:8",
0
]
},
"_meta": {
"title": "Save Image"
}
},
"71": {
"class_type": "LoadImage",
"inputs": {
"image": "image_qwen_image_instantx_controlnet_input_image.jpg"
},
"_meta": {
"title": "Load Image"
}
},
"73": {
"class_type": "PreviewImage",
"inputs": {
"images": [
"112:22",
0
]
},
"_meta": {
"title": "Preview Image"
}
},
"113": {
"class_type": "FluxKontextImageScale",
"inputs": {
"image": [
"71",
0
]
},
"_meta": {
"title": "FluxKontextImageScale"
}
},
"111:3": {
"class_type": "KSampler",
"inputs": {
"cfg": 1,
"denoise": 1,
"latent_image": [
"111:76",
0
],
"model": [
"111:66",
0
],
"negative": [
"111:85",
1
],
"positive": [
"111:85",
0
],
"sampler_name": "euler",
"scheduler": "simple",
"seed": 498544006715206,
"steps": 4
},
"_meta": {
"title": "KSampler"
}
},
"111:37": {
"class_type": "UNETLoader",
"inputs": {
"unet_name": "qwen_image_fp8_e4m3fn.safetensors",
"weight_dtype": "default"
},
"_meta": {
"title": "Load Diffusion Model"
}
},
"111:38": {
"class_type": "CLIPLoader",
"inputs": {
"clip_name": "qwen_2.5_vl_7b_fp8_scaled.safetensors",
"device": "default",
"type": "qwen_image"
},
"_meta": {
"title": "Load CLIP"
}
},
"111:39": {
"class_type": "VAELoader",
"inputs": {
"vae_name": "qwen_image_vae.safetensors"
},
"_meta": {
"title": "Load VAE"
}
},
"111:6": {
"class_type": "CLIPTextEncode",
"inputs": {
"clip": [
"111:38",
0
],
"text": "Post-apocalyptic style clothing, long wavy hair, rough texture, exotic woman, tattered coarse-woven linen fabric, wearing a hood, mechanical aesthetics, mainly in dark gray tones, low-saturation earthy yellow, sense of impact and rebellion, doomsday aesthetics, grotesque aesthetics, works of art, backlighting, film photography, professional photography works, clear visible face, emotional and atmospheric dynamic photography, Fujichrome color positive film, shot with a 17mm Hasselblad ultra-wide-angle lens, f/1.2 large aperture, side backlighting, artistic light, hair light, Rembrandt light, 8K high-definition image quality, delicate real human skin texture."
},
"_meta": {
"title": "CLIP Text Encode (Positive Prompt)"
}
},
"111:66": {
"class_type": "ModelSamplingAuraFlow",
"inputs": {
"model": [
"111:80",
0
],
"sampling": "flow",
"shift": 3.1000000000000005
},
"_meta": {
"title": "ModelSamplingAuraFlow"
}
},
"111:7": {
"class_type": "CLIPTextEncode",
"inputs": {
"clip": [
"111:38",
0
],
"text": ""
},
"_meta": {
"title": "CLIP Text Encode (Negative Prompt)"
}
},
"111:76": {
"class_type": "VAEEncode",
"inputs": {
"pixels": [
"112:22",
0
],
"vae": [
"111:39",
0
]
},
"_meta": {
"title": "VAE Encode"
}
},
"111:8": {
"class_type": "VAEDecode",
"inputs": {
"samples": [
"111:3",
0
],
"vae": [
"111:39",
0
]
},
"_meta": {
"title": "VAE Decode"
}
},
"111:80": {
"class_type": "LoraLoaderModelOnly",
"inputs": {
"lora_name": "Qwen-Image-Lightning-4steps-V1.0.safetensors",
"model": [
"111:37",
0
],
"strength_model": 1
},
"_meta": {
"title": "Load LoRA"
}
},
"111:84": {
"class_type": "ControlNetLoader",
"inputs": {
"control_net_name": "Qwen-Image-InstantX-ControlNet-Union.safetensors"
},
"_meta": {
"title": "Load ControlNet Model"
}
},
"111:85": {
"class_type": "ControlNetApplyAdvanced",
"inputs": {
"control_net": [
"111:84",
0
],
"end_percent": 1,
"image": [
"112:22",
0
],
"negative": [
"111:7",
0
],
"positive": [
"111:6",
0
],
"start_percent": 0,
"strength": 1,
"vae": [
"111:39",
0
]
},
"_meta": {
"title": "Apply ControlNet"
}
},
"112:10": {
"class_type": "UNETLoader",
"inputs": {
"unet_name": "lotus-depth-d-v1-1.safetensors",
"weight_dtype": "default"
},
"_meta": {
"title": "Load Diffusion Model"
}
},
"112:14": {
"class_type": "VAELoader",
"inputs": {
"vae_name": "vae-ft-mse-840000-ema-pruned.safetensors"
},
"_meta": {
"title": "Load VAE"
}
},
"112:16": {
"class_type": "SamplerCustomAdvanced",
"inputs": {
"guider": [
"112:19",
0
],
"latent_image": [
"112:23",
0
],
"noise": [
"112:18",
0
],
"sampler": [
"112:21",
0
],
"sigmas": [
"112:28",
0
]
},
"_meta": {
"title": "SamplerCustomAdvanced"
}
},
"112:18": {
"class_type": "DisableNoise",
"inputs": {},
"_meta": {
"title": "DisableNoise"
}
},
"112:19": {
"class_type": "BasicGuider",
"inputs": {
"conditioning": [
"112:68",
0
],
"model": [
"112:10",
0
]
},
"_meta": {
"title": "Basic Guider"
}
},
"112:20": {
"class_type": "BasicScheduler",
"inputs": {
"denoise": 1,
"model": [
"112:10",
0
],
"scheduler": "normal",
"steps": 1
},
"_meta": {
"title": "BasicScheduler"
}
},
"112:21": {
"class_type": "KSamplerSelect",
"inputs": {
"sampler_name": "euler"
},
"_meta": {
"title": "KSamplerSelect"
}
},
"112:22": {
"class_type": "ImageInvert",
"inputs": {
"image": [
"112:8",
0
]
},
"_meta": {
"title": "Invert Image Colors"
}
},
"112:23": {
"class_type": "VAEEncode",
"inputs": {
"pixels": [
"113",
0
],
"vae": [
"112:14",
0
]
},
"_meta": {
"title": "VAE Encode"
}
},
"112:28": {
"class_type": "SetFirstSigma",
"inputs": {
"sigma": 999.0000000000002,
"sigmas": [
"112:20",
0
]
},
"_meta": {
"title": "SetFirstSigma"
}
},
"112:68": {
"class_type": "LotusConditioning",
"inputs": {},
"_meta": {
"title": "LotusConditioning"
}
},
"112:8": {
"class_type": "VAEDecode",
"inputs": {
"samples": [
"112:16",
0
],
"vae": [
"112:14",
0
]
},
"_meta": {
"title": "VAE Decode"
}
}
})
# run() also passes api_key to the partner nodes in this workflow.
job = client.run(workflow, api_key=api_key)常见问答
You need to download the diffusion model 'lotus-depth-d-v1-1.safetensors' and the VAE model 'vae-ft-mse-840000-ema-pruned.safetensors' from Huggingface or Modelscope.
This workflow is optimized for high-quality image generation rather than real-time applications. It is best suited for projects where processing time is less critical.
The choice depends on your project needs. Use canny for edge detection, soft edge for smoother transitions, depth for 3D effects, and pose for specific body positioning.
Yes, you can configure multiple nodes to apply various control techniques simultaneously, allowing for complex and customized image outputs.