Qwen Edit Any2Latent
Cast an ANY wire to a LATENT so the sampler accepts it
- item
- item
The latent-shaped twin of QwenEditAny2Image, and just as simple. The QwenEditUtils pack shuttles data around as the generic ANY type, but a KSampler wants a real LATENT on its latent_image input, not an ANY. Any2Latent is the adapter that relabels the socket so the connection is legal. It's a two-second fix for the "these two sockets won't link" problem, aimed at latents.
Where it shows up: you've pulled a reference latent out of the Custom node's ref_latents list with QwenEditListExtractor, it came out as ANY, and now you want to actually sample from it. Drop Any2Latent in between and the link works.
How it works
Pass-through. The node changes the declared socket type from ANY to LATENT and touches none of the underlying data. You're not decoding, re-encoding, or converting anything - you're telling ComfyUI's type checker what it's already holding. It's free and instant for exactly that reason.
The inputs and outputs that matter
Input: item - the ANY value you know is a latent.
Output: item - the same value, now typed LATENT and ready for a sampler or any latent-consuming node.
No widgets, no choices. It does one thing.
Where it fits in a real graph
Here's the exact situation you'll be in. TextEncodeQwenImageEditPlusCustom emits a custom_output dictionary; QwenEditOutputExtractor breaks it open and exposes a ref_latents list; QwenEditListExtractor at some index reaches in and hands you one of those latents - but typed ANY, since a list is type-agnostic. Feed that into QwenEditAny2Latent and it becomes a real LATENT you can wire into a KSampler's latent_image, a latent upscale, or a VAE Decode. Try to make that connection without the cast and ComfyUI blocks it: an ANY output won't snap into a LATENT input, so the socket just refuses you. This node is the two-second unblock.
Installing it
Comes with the pack. ComfyUI Manager: search Comfyui-QwenEditUtils, install, restart. Or cd ComfyUI/custom_nodes && git clone https://github.com/lrzjason/Comfyui-QwenEditUtils, restart. No models, no dependencies.
Common issues
Same single caveat as its image sibling: it relabels, it doesn't validate. Cast an ANY that's really an image (or a config, or a mask) to LATENT and the sampler will reject it downstream with an error that looks unrelated to the real cause. Only use it on values you know came from a latent path - ref_latents, or the Custom/encoder latent outputs that got routed through something generic. If the thing is actually an image, you want QwenEditAny2Image instead. These two casters exist purely because the pack leans on ANY-typed plumbing; they're the small tax you pay for that flexibility.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| item | ANY | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| item | LATENT | — |