Nodes/ComfyUI-ppm/Latent to Width & Height
ComfyUI Node

Latent to Width & Height

Pull the real dimensions off a latent

By pamparamm·Created 2 years ago·Updated about 22 hours ago· 265
Latent to Width & Height
  • latent
  • width
  • height

This one's a plumbing node, and that's a compliment. It takes a LATENT and spits out its width and height as two integers. That's the entire job. No settings, nothing to tune, no way to get it wrong. If you've ever needed to know "how big is this thing, in pixels" partway through a workflow, this is the node.

Why you'd reach for it

In ComfyUI, dimensions have an annoying habit of getting lost. You set width and height way back at your EmptyLatentImage, and then twelve nodes later you need those exact numbers again - to size a mask, to feed an upscaler, to build a matching blank latent, to drive a resize. The lazy fix is to hardcode 1024 again and hope you didn't change it upstream. The right fix is to read the dimensions off the latent that's actually flowing through the graph, so they stay correct no matter what you did earlier.

That's what makes this useful: it turns a value you set into a value you can route. Change the source resolution once and everything downstream that pulls from this node updates automatically. No more three-places-to-edit bugs where you bump the resolution but forget the upscale target still says the old number.

The one thing to know about the numbers

Here's the detail that saves you a confused half-hour. A latent is 8× smaller than the image it decodes to - SDXL and SD1.5 VAEs downsample by a factor of 8, so a 1024×1024 image is a 128×128 latent under the hood. This node does the sensible thing and gives you the image-space dimensions (1024×1024), not the raw latent tensor size. So the width and height you get out are the pixel dimensions you'd expect after VAE decode, which is almost always what you want. If you were bracing to multiply by 8 yourself, you don't have to.

Inputs and outputs

About as short as a node gets:

  • latent (LATENT) in - any latent, from an empty latent, a VAE encode, a sampler output, whatever.
  • width (INT) and height (INT) out - wire them wherever an integer dimension is wanted.

Common landing spots for those outputs: an upscaler's target size, another EmptyLatentImage's width/height, a LatentUpscale, a mask generator, an image resize, or any math node where you want to compute a scaled dimension.

Install

Trivial, no dependencies, no models:

  • ComfyUI Manager: search "ComfyUI-ppm", install, restart.
  • Manual: cd ComfyUI/custom_nodes && git clone https://github.com/pamparamm/ComfyUI-ppm, then restart.

Gotchas

There basically aren't any - this is one of the least breakable nodes in the pack. The only thing to keep straight is the point above: you're getting decoded pixel dimensions, not the ÷8 latent tensor shape, so don't second-guess and multiply again. And if it ever throws an error after you update ComfyUI-ppm (the pack-wide quirk), just delete the node and re-add it.

Is it a headline node? No. But clean graphs are built out of exactly these little routing pieces, and a workflow that reads its dimensions instead of hardcoding them is a workflow that doesn't silently break when you change the resolution. Grab it, wire it once, forget it exists.

Categorylatent

Inputs (1)

NameTypeDefaultDescription
latentLATENT

Outputs (2)

NameTypeDescription
widthINT
heightINT