Get latent size
Read a latent's width and height (and the 8x gotcha)
- latent
- WIDTH
- HEIGHT
The latent-space cousin of Get image size. Feed it a latent and it hands back width and height as integers you can do math with. Same use case - you need to know how big something is so the rest of the graph can compute off it - but with one wrinkle that trips people up, and this node has a toggle specifically for it.
It's from Derfuu_ComfyUI_ModdedNodes, the utility pack built for automating size arithmetic inside ComfyUI.
The 8x thing (read this first)
A latent is not the same size as the image it decodes to. ComfyUI's VAE compresses by a factor of 8 in each dimension: a 512x512 image is a 64x64 latent. The pack's own README flags it - "original values for latents are 8 times smaller."
That's what the original toggle controls. It lets you choose which numbers you want back:
- The pixel-space size (the 512 you actually care about), or
- The raw latent tensor size (the 64 the model sees).
Pick based on what the downstream node expects. If you're wiring into an Empty Latent or another latent op, you likely want raw latent dimensions; if you're computing a pixel target, you want the multiplied-up size. When numbers come out looking wrong by a factor of 8, this toggle is the first thing to flip.
The inputs and outputs
latent(LATENT) - the input, from an Empty Latent, a VAE Encode, or mid-pipeline.original- the enum that decides whether you get raw latent size or the pixel-equivalent size.- Outputs
WIDTH(INT) andHEIGHT(INT).
Those INT outputs go straight into math nodes, a latent scaler like Latent Scale to side, or an Empty Latent.
Where it fits
Hi-res-fix and latent-upscale workflows are the natural home. You read the current latent's size, compute a bigger target, and drive a latent resize - all without decoding to pixels and back. It keeps a multi-pass workflow adaptive instead of hardcoded to one resolution.
Common issues & troubleshooting
Everything's off by 8x. The original toggle is set to the mode you didn't want. Flip it. This is the single most common confusion with this node, and it's not a bug - it's the VAE compression factor.
Node red / missing after an update. Derfuu has a history of removing old node classes on reorg rather than keeping them deprecated, so pack updates can break saved graphs. Update via Manager and re-add the node.
ModuleNotFoundError: No module named 'custom_nodes.Derfuu_ComfyUI_ModdedNodes'. An old workflow referencing a module path that moved. Update the pack, reload, replace the stale node.
Install: ComfyUI Manager → search "Derfuu" → install → restart, or cd ComfyUI/custom_nodes && git clone https://github.com/Derfuu/Derfuu_ComfyUI_ModdedNodes then restart. No models, no heavy dependencies.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| latent | LATENT | — | |
| original | COMBO | 2 options: false, true |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| WIDTH | INT | — |
| HEIGHT | INT | — |