Nodes/ComfyUI-EditUtils/EditUtils: Any2Latent lrzjason
ComfyUI Node

EditUtils: Any2Latent lrzjason

Wrap a Loose Latent Tensor Into Something a Sampler Will Accept

By lrzjason·Created 7 months ago·Updated 16 days ago· 207
EditUtils: Any2Latent lrzjason
  • item
  • item

Any2Latent_EditUtils is the latent-flavored twin of Any2Image: one ANY input, one typed output, no heavy lifting. The only difference is what it does to the value on its way through - it wraps the incoming tensor in the {"samples": tensor} dictionary shape that ComfyUI's LATENT type actually is.

That wrapping is the entire reason this node exists, and it's worth understanding because it explains a lot of confusing ComfyUI behavior. A LATENT isn't a bare tensor in the graph - it's a dict whose samples key holds the actual noise/denoised tensor (and can carry extras like a noise_mask). The EditUtils encode nodes hand back a custom_output ANY socket that contains latents and all kinds of other internals as one blob. When you want to pull the latent out of that blob and feed it to a VAE decoder or a sampler, you need it back in proper LATENT form. That's this node's job: take the tensor out of the ANY pipe and package it the way ComfyUI expects.

Realistic spot you'll use it: you've got a custom_output from EditTextEncode_EditUtils, you've unwrapped it, and there's a latent tensor floating around in the graph - maybe from an Output Extractor's ref_latents list, maybe from ListExtractor_EditUtils pulling item zero off a list. Feed that tensor into Any2Latent and now it's a real LATENT you can wire into a VAEDecode or hand to a KSampler as a starting point.

Same caveat as its sibling, so say it once: no validation, no conversion. It wraps whatever you give it. Hand it a conditioning dict or an IMAGE tensor and you'll get a plausible-looking latent that explodes the moment something tries to denoise it. Use it when you know the ANY value is a latent tensor - the typical source is a node you've already seen the code of, not a guess.

It's part of lrzjason/ComfyUI-EditUtils, so install is the pack's shared one-liner: ComfyUI Manager (search "EditUtils") or git clone https://github.com/lrzjason/ComfyUI-EditUtils into custom_nodes, then restart. No dependencies beyond what ComfyUI already ships, and no model files. If you're new to this pack, this node and Any2Image are the ones you'll sprinkle in when the graph's type checker throws a fit - they're not exciting, they just unblock the wire.

Categoryadvanced/conditioning

Inputs (1)

NameTypeDefaultDescription
itemANY

Outputs (1)

NameTypeDescription
itemLATENT