Nodes/ComfyUI-Qwen-Image-Integrated-KSampler/🐋 千问图像集成采样器——Github:@luguoli
ComfyUI Node

🐋 千问图像集成采样器——Github:@luguoli

The Qwen-Image sampler that eats your wire spaghetti

By luguoli·Created 9 months ago·Updated 8 months ago· 243
🐋 千问图像集成采样器——Github:@luguoli
  • model
  • clip
  • vae
  • image1
  • image2
  • image3
  • image4
  • image5
  • latent
  • controlnet_data
  • 生成图像Image
  • (可选)Latent
  • 缩放后原图Scaled Image
positive_prompt
negative_prompt
generation_mode
batch_size1
width0
height0
seed0
steps4
cfg1.0
sampler_nameeuler
schedulersimple
denoise1.00
auraflow_shift3.00
cfg_norm_strength1.00
enable_clean_gpu_memoryfalse
enable_clean_cpu_memory_after_finishfalse
enable_sound_notificationfalse
auto_save_output_folder
output_filename_prefixauto_save
instructionDescribe the key features of the input image (color, shape, size, texture, objects, background), then explain how the user's text instruction should alter or modify the image. Generate a new image that meets the user's requirements while maintaining consistency with the original input where appropriate.

If you've ever built a Qwen-Image or Z-Image workflow the "official" way, you know the feeling: a prompt encoder, an AuraFlow shift node, a CFG normalization node, a latent creator, a KSampler, a VAE decode, plus scaling and cleanup nodes, all draped in a dozen wires. This node is that entire pipeline collapsed into one box. Load your model, clip and VAE, type a prompt, and it does prompt encoding, sampling, decoding, optional auto-save, even VRAM cleanup - and it's exactly how people actually run Qwen and Z-Image these days. The community recommendation for a Z-Image depth workflow was literally "use this, two or three nodes is enough."

It's the flagship of luguoli's pack (the whale 🐋, "千问图像集成采样器"), and it does double duty: text-to-image and image-to-image in a single node, including Qwen-Image-Edit-style instruction editing with up to five reference images.

How it works

Pick generation_mode. In text-to-image it just tokenizes your prompt and makes an empty latent at the width/height you set. In image-to-image the interesting stuff happens: each reference image is encoded twice at once - once into the vision-language encoder as 384×384 image tokens, and once into the VAE at the image's strict original resolution (rounded to a multiple of 8). That dual-encode is the whole Qwen-Edit design. And the "strict original resolution" part is the point of this node: the official TextEncodeQwenImageEditPlus used to upscale your reference, which is where the infamous offset/shrink artifacts came from. This keeps the latent true to the input, and the pack's own code comment says exactly that - it exists to solve the offset problem while keeping the official node's instruction-following.

Before sampling it can also apply two tweaks. auraflow_shift (default 3.0) patches a flow-sampling shift onto the model - the AuraFlow technique for balancing schedule shape, speed and quality. cfg_norm_strength (default 1.0) installs a post-CFG normalization that stops high guidance from oversaturating. Both only engage when set above zero, so 0 turns them off. If you've wired in controlnet_data from the companion loader, each condition gets applied here, with repaint masks scaled to match your target size.

Inputs that matter

  • generation_mode - text-to-image or image-to-image.
  • width / height - required for text-to-image (it throws otherwise). For image-to-image, setting them letterboxes your references to that size while keeping aspect ratio; 0 means no scaling.
  • image1image5 - the references, up to five, image1 being the main one. No image1 in image-to-image mode and it refuses to run.
  • denoise - lower it in image-to-image to keep more of the original.
  • steps (default 4), cfg (default 1.0), sampler_name, scheduler - the usual suspects. Qwen is LLM-encoded and prompt it in sentences, not tags; it's happy in the 4–20 step range, and pushing CFG much past ~7 burns the image.
  • batch_size - 1–10. Start at 1 and watch your VRAM.
  • auto_save_output_folder - set a path (absolute, or relative to ComfyUI's output dir) and every result saves as prefix_seed_00000.png. Leave blank to disable.

Three outputs: the generated Image, the Latent (handy if you want to chain a refiner without a decode/encode round trip), and the Scaled Image - a preview of what the sampler actually saw, which saves you an "oh no, it upscaled my reference" moment.

Install

cd ComfyUI/custom_nodes
git clone https://github.com/luguoli/ComfyUI-Qwen-Image-Integrated-KSampler.git
pip install -r requirements.txt

Then restart ComfyUI. Or ComfyUI Manager → search "ComfyUI-Qwen-Image-Integrated-KSampler" → Install. The requirements are all standard (torch, transformers, einops, psutil) and the repo ships no weights. The real dependency is the model: Qwen-Image is a 20B MMDiT and a VRAM hog, so quantization is basically deployment, not an option - GGUF, fp8, or Nunchaku SVDQuant on consumer cards. This node also handles Z-Image fine, and that one runs on a 6GB card.

Gotchas

Text-to-image without width/height errors out on purpose, and image-to-image without image1 does too - both messages are bilingual and clear. The sound notification is Windows-only (winsound), so don't expect a chime on Linux. The "clean CPU memory after finish" option is aggressive: it flushes file cache, processes and dynamic libraries, so enable it only when a long session is leaking. And if you want the Chinese UI, the post-ComfyUI-0.3.68 localization break means you'll need to run the pack's 自动汉化节点.bat and install ComfyUI-DD-Translation. That's a lot of Chinese characters for one node - but then, the node itself just saved you about seven wires.

Categorysampling

Inputs (30)

NameTypeDefaultDescription
modelMODEL🤖 Model - 扩散模型输入,用作图像生成的核心模型
clipCLIP🟡 Clip - CLIP模型,用于文本编码和条件生成
vaeVAE🎨 Vae - VAE模型输入,用于将潜空间解码为最终可见图像
positive_promptSTRING✅ 正向提示 - 描述期望图像元索的文本提示
negative_promptSTRING❌ 负向提示 - 描述要避免的图像元素的文本提示
generation_modeCOMBO🎨 生成模式 - 选择文生图或图生图模式
batch_sizeINT11–10📦 批次数量 - 生成图像的数量
widthINT00–16384📐 宽度(文生图-必填,图生图-填写缩放/填0不缩放)
heightINT00–16384📏 高度(文生图-必填,图生图-填写缩放/填0不缩放)
seedINT00–18446744073709550000🎲 生成噪波的随机种。
stepsINT41–10000📊 降噪的步数。
cfgFLOAT1.00–100🎛️ 用于平衡随机性和提示词服从性。提高该值会使结果更加符合提示词,但过高会导致图像质量下降。
sampler_nameCOMBOeuler🌀 采样算法,会影响结果质量、生成速度、风格样式。
schedulerCOMBOsimple📈 控制逐渐移除噪波的方法。
denoiseFLOAT1.000–1🔄 降噪的强度,降低该值会保留原图的大部分内容从而实现图生图。
image1optIMAGE🖼️ 图像1(主图) - 参考图像1(主图),用于条件生成和潜空间编码。如果不传入,则文生图。
image2optIMAGE🖼️ 图像2 - 参考图像2,用于条件生成和潜空间编码
image3optIMAGE🖼️ 图像3 - 参考图像3,用于条件生成和潜空间编码
image4optIMAGE🖼️ 图像4 - 参考图像4,用于条件生成和潜空间编码
image5optIMAGE🖼️ 图像5 - 参考图像5,用于条件生成和潜空间编码
latentoptLATENT🟣 Latent - 文生图、图生图(传入了主图)可不传,自动创建,如需使用ControlNet等可自行传入
controlnet_dataoptCONTROL_NET_DATA🌿 ControlNet 数据(可选) - 输入 ControlNet 集成加载器输出的数据包,直接应用 ControlNet 控制
auraflow_shiftoptFLOAT3.000–100⚡ 采样算法AuraFlow移位 - 采样算法(AuraFlow) 移位Shift参数,影响速度和质量 (0-100)
cfg_norm_strengthoptFLOAT1.000–100⚖️ CFGNorm 强度 - CFG标准化强度,动态调整CFG指导强度 (0-100)
enable_clean_gpu_memoryoptBOOLEANfalse🗑️ 清理显存占用 - 在采样/解码前后清理显存占用,以释放资源给其他应用
enable_clean_cpu_memory_after_finishoptBOOLEANfalse🗑️ 完成后清理内存 - 生成完成后清理CPU内存
enable_sound_notificationoptBOOLEANfalse🔊 完成后播放声音 - 解码完成后播放通知声音以提醒用户
auto_save_output_folderoptSTRING📁 自动保存输出文件夹(留空不自动保存) - 留空则不执行保存
output_filename_prefixoptSTRINGauto_save📝 输出文件名前缀 - 默认auto_save
instructionoptSTRINGDescribe the key features of the input image (color, shape, size, texture, objects, background), then explain how the user's text instruction should alter or modify the image. Generate a new image that meets the user's requirements while maintaining consistency with the original input where appropriate.📝 指令 - 系统指令,用于指导参考图像的图像编辑

Outputs (3)

NameTypeDescription
生成图像ImageIMAGE
(可选)LatentLATENT
缩放后原图Scaled ImageIMAGE