Nodes/Qwen Image 2.1 Fun ControlNet Union (T8)/Qwen 2.1 Latent From Control Image
ComfyUI Node

Qwen 2.1 Latent From Control Image

The empty latent that knows your aspect ratio

By T8mars·Created 2 days ago·Updated 2 days ago· 3
Qwen 2.1 Latent From Control Image
  • image
  • LATENT
◄resolution1024►

Two inputs, one output, and a name that oversells what it does. Qwen 2.1 Latent From Control Image does not encode your image, and it isn't img2img. It computes the latent canvas the model should sample into - 64 channels, 16× spatial downscale, filled with zeros - sized to match the aspect ratio of the image you feed it.

That's the entire job, and it's the job you need. Pose transfer, depth-guided composition, canny: in all three cases the output should have the same shape as the control map. Use a square empty latent and your carefully extracted 2:3 pose skeleton gets squeezed into a square frame, and the ControlNet then fights the prompt about anatomy for forty steps. This node is how the pack's own workflows avoid that: drop it in, wire image, set resolution, and it replaces the empty-latent node entirely.

How it works

The math is short and worth knowing because it explains the failure mode. It reads the image's width/height ratio and solves for a target whose pixel area is resolution², then rounds both sides down to multiples of 32:

target_width  = round(sqrt(resolution^2 * (w/h)) / 32) * 32
target_height = round(sqrt(resolution^2 / (w/h)) / 32) * 32

So resolution is an area knob, not a side length. 1024 on a 2:1 image gives you roughly 1448×724, not 1024 wide with something cropped off. The latent is then [1, 64, height/16, width/16] - 64 channels, which is the Qwen Image 2.1 latent format. If you handed the pack's workflows a 1024×1024 output from a 16:9 control map, you'd get bars or stretch; this node is why you don't have to think about it.

Two guards, both from the release audit. A batch of more than one image raises ("connect one image; native Qwen Image 2.1 uses only the first control image"). And if the aspect ratio would push a computed side past 4096 pixels, it refuses with the actual computed dimensions in the message rather than letting you OOM twenty seconds into sampling. An extreme panoramic input can't be fixed by lowering resolution alone - past a point you have to crop or pad the map.

Wiring it

The output is a LATENT; it goes into KSampler's latent_image. In the pack's canny workflow that's the only latent source in the graph, and in the inpaint workflow it's fed from the source image, not the control map - which is the right instinct, since the thing you want matched is the picture you're fixing, not the depth map describing it.

Want more than one seed from the same control? Reject-batch aside, the README's advice is to repeat the latent batch after this node, then sample. The latents are all zeros anyway, so repeating costs nothing.

In the inpaint workflow it sits alongside Apply Qwen Image 2.1 UNION, which is the node the control map itself goes into.

Install

If you got here, you probably already installed the pack:

cd ComfyUI/custom_nodes
git clone https://github.com/T8mars/Comfyui-Qwen-Image-2.1-Fun-Controlnet-Union-T8
# restart ComfyUI

No pip dependencies, but you do need a ComfyUI build with native Qwen Image 2.1 Fun support (upstream PR #16519 or later) and the four model files from the README - the converted Union checkpoint into models/controlnet/, plus the Qwen 2.1 diffusion model, Qwen3-VL 8B text encoder, and 2.1 VAE in their own folders. The pack's workflows/ folder has nine graphs ready to drag in once those are placed.

Common issues

  • "Control image aspect ratio produces NxM" - your input is too elongated for that resolution. Crop/pad it, or drop resolution (minimum 256, step 32).
  • Batch error - something upstream is emitting more than one image per batch. Fix it at the source; a T2I batch and a control map don't mix here.
  • resolution feels like it does nothing visible - it's area-preserving on the ratio, so at 1024 and 2048 you get the same shape at different sizes. The rounding to 32 means you'll rarely hit an exact number, and that's fine.
  • Mixing latent formats. This node exists because the 2.1 latent isn't the shape an arbitrary empty-latent node produces. If you're building on someone's old Qwen-Image graph, replace that node rather than adding this one next to it.
CategoryQwen Image 2.1/Union

Inputs (2)

NameTypeDefaultDescription
imageIMAGE—
resolutionINT1024256–4096—

Outputs (1)

NameTypeDescription
LATENTLATENT—