Nodes/ComfyUI-latent-ops/Latent01ToImage
ComfyUI Node

Latent01ToImage

Peek inside a 0-1 latent without paying for a VAE decode

By hnmr293·Created about a year ago·Updated about a year ago· 2
Latent01ToImage
  • latent
  • image

The normal way to "see" a latent is to VAE-decode it, which is slow and lossy and pointless when all you want is to confirm that your latent-math experiment actually did something. Latent01ToImage is the cheap way: it turns a latent whose values already live in 0-1 straight into an image tensor you can preview. No VAE, no decode cost, just a reshape.

It's from hnmr293's ComfyUI-latent-ops pack - the same author as sd-webui-cutoff and llul - and it's one of the few nodes there that works directly on a LATENT and hands back an IMAGE. Install the pack and it's under hnmr/latent_ops.

How it works

The mechanism is short and honest. The node takes latent["samples"], adds a batch dimension if it's 2D, and requires a 3D (C, H, W) or 4D (B, C, H, W) tensor. If you've got exactly one channel, it repeats it to three so the preview isn't greyscale-by-accident. Then it moves the channel axis to the end - (B, C, H, W)(B, H, W, C) - and hands you an IMAGE.

The critical caveat is in the name: it does not normalize. It assumes the latent is already 0-1. A raw SD/SDXL latent spans roughly -2 to 2, so feeding one straight in gives you a washed-out noise preview that tells you nothing. This node is for after a normalization step - this same pack has NormalizeMinMax, NormalizePercentile, Clamp, and friends - or for latents that genuinely live in 0-1.

The one input, the one output

  • latent in, image out. Wire the image to PreviewImage or SaveImage and you're done.

Also worth knowing: if your latent has 4 channels (the standard SD/SDXL layout), you get a 4-channel image out. It previews, but that fourth channel is just another noise channel, not a real alpha.

Installing it

No dependencies, no model files - pure torch math. ComfyUI Manager → search "ComfyUI-latent-ops" → install, or:

cd ComfyUI/custom_nodes
git clone https://github.com/hnmr293/ComfyUI-latent-ops

Restart ComfyUI.

Troubleshooting

The error you'll actually hit is "Expected 1, 3, or 4 channels" - that's the 16-channel Flux latent, which this node can't preview (4 channels is the ceiling). If your preview looks like garbage, the values aren't in 0-1; run a Clamp or NormalizeMinMax first. And if your latent is centered on zero instead, that's exactly what Latent11ToImage is for - it applies the x*0.5+0.5 remap for you.

Categoryhnmr/latent_ops

Inputs (1)

NameTypeDefaultDescription
latentLATENT

Outputs (1)

NameTypeDescription
imageIMAGE