Latent Ch to Batch
See what your VAE actually encoded, channel by channel
- latent
- images
You cannot look at a latent. It's a [B,C,H,W] tensor of floats - 4 channels on SD 1.5/SDXL, 16 on Flux - and ComfyUI's Preview Image refuses to draw it for a reason. Latent Ch to Batch is one of two nodes in the comfyui-latent-viewer pack that fix that: it turns every channel of a latent into its own grayscale image, stacks them along the batch dimension, and hands you a plain IMAGE that the built-in Preview Image tiles into a grid for you.
Why reach for it? Mostly to stop guessing. If you've ever wondered what the VAE actually squeezed into those 64×64 latents, whether a LoRA is doing anything at the channel level, or why a model looks wrong after an encode-decode round trip, this is the node that shows you. The pack is written by Dr. Nobutaka Kuroki (Kobe University) and is explicitly a teaching tool - its sample workflow encodes an image, previews the channels, and puts a VAE-decoded reconstruction next to them so you can compare the input latent against what comes out the other end.
How it works
Under the hood it reads the samples tensor out of the LATENT dict, grabs one image from the batch, and renders each of its C channels as a signed-grayscale map. Key design choice: the mean is never subtracted, so a latent value of zero renders as neutral gray, positive values go brighter, negative darker - you can see the sign of a channel's activations at a glance. Everything is upscaled with nearest-neighbor (so small feature maps stay blocky and readable, not blurry), normalized into a usable range, and returned as a batch of images. It's read-only: your latent is never modified, and nothing here decodes it back into pixels.
The inputs that matter
- latent - plug in any
LATENT. Channel count isn't assumed, so 4-channel SD1.5 and 16-channel Flux both work. - batch_index (default 0) - which image in the batch to inspect. If you pick a number beyond the batch size it silently clamps to the last image rather than erroring, so don't rely on it to complain.
- normalize_mode (default
global_std) - five options: std-based (global_std,per_channel_std), min-max stretch (global_minmax,per_channel_minmax), andfixed_range, wherescaleis the absolute clamp limit. The default is usually fine. If a channel renders as a solid black slab, that's not a bug - its values are just tiny relative to the global range, so switch toper_channel_minmaxto spread each channel's range out and actually see it. - scale (default 3) and upscale (default 4) - how aggressively values get divided, and how much nearest-neighbor enlargement to apply. Leave both alone until you have a reason.
The output is images: an IMAGE batch with one frame per channel. Wire it into Preview Image (which auto-lays-out the grid) or Save Image.
Install
ComfyUI Manager: search "comfyui-latent-viewer" and hit install. Or the manual route:
cd ComfyUI/custom_nodes
git clone https://github.com/NobutakaKuroki/comfyui-latent-viewer
Restart ComfyUI. That's the whole thing - the pack's dependencies list is empty, so no torch extras, no model files to download. The nodes appear under KULab/Visualize.
What you'll actually see
Grey blobs. For SD1.5 that's not broken output, it's the truth - the four channels of a trained VAE encode structural information (edges, coarse layout, colour-ish residuals), not a picture. This is the part beginners bounce off: the tiles are the input to the diffusion model, not the image it's trying to make. If you want to see the image, VAEDecode it - the workflow does both side by side. And if a decoded latent comes out as noise or flat colour, the cause is almost always a VAE whose channel count doesn't match the model (a 4-channel VAE on a 16-channel latent), which this node will make obvious the moment you look at how many tiles you got.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| latent | LATENT | — | |
| batch_index | INT | 00–4096 | — |
| normalize_mode | COMBO | global_std | 5 options: global_std, per_channel_std, global_minmax, per_channel_minmax, fixed_range |
| scale | FLOAT | 3.00.1–10 | — |
| upscale | INT | 41–32 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| images | IMAGE | — |