Nodes/ComfyUI-ResizeDimensions/Resize Dimensions (W/H)
ComfyUI Node

Resize Dimensions (W/H)

Resize Dimensions (W/H) sizes your latent for you

By normbarrette-arch·Created 3 months ago·Updated 3 months ago· 0
Resize Dimensions (W/H)
  • image
  • width
  • height
  • latent
mode
edge_length1080
width_a1024
height_a1024
width_b1024
height_b576
round_to8
latent_type
batch_size1

Every ComfyUI workflow has to pick a resolution, and getting it wrong is the single most common way to get a bad image. Generate too far off a model's native size and you get stretched bodies, double heads, or that "trained on 1024x1024" warning so many people have pasted into r/StableDiffusion. Resize Dimensions (W/H) - one node from a one-node pack called ComfyUI-ResizeDimensions - exists to kill the fiddly part: it reads an image's aspect ratio and hands you back a latent-safe width and height, plus an empty LATENT already sized to match. The name is a slight lie, by the way. It does not resize anything. It never resamples a pixel; the image is read purely for its aspect ratio. It's a calculator with a wire on the end.

Why you'd reach for it

The usual ComfyUI pattern is: you load a reference image, want your generation to match its framing, and then you're doing arithmetic - "okay, 1536 wide at 4:3 is 1152 tall, and it needs to be a multiple of 8…" You don't want to be doing that at 2 a.m. This node automates it. Pin the long edge to 1080 and it works out the other side, preserving the aspect ratio, then snaps both to your chosen multiple. That snapping matters more than it looks: the latent space is downsampled 8x from pixels, and every model family has its own discipline around it - Flux effectively wants multiples of 64, SDXL has a short list of trained ratios, and generating at 1920x1080 directly on SDXL is how you get tiling and warped anatomy.

How it works

Under the hood the node just reads the image tensor's shape - ComfyUI images are (Batch, Height, Width, Channels), so it grabs shape[1] and shape[2] - and runs it through whichever sizing function the mode picks. long edge pins the longer side of the source to edge_length and scales the other to keep the ratio; short edge does the same to the shorter side (handy when you're upscaling a portrait crop to fill a frame). Then both values get snapped to the nearest round_to multiple, ties rounding up. The LATENT output is built exactly like the core EmptyLatentImage / EmptySD3LatentImage nodes: a torch.zeros tensor at height//8 × width//8, so you can wire it straight into the KSampler's latent input and never place an Empty Latent Image node at all.

The inputs that matter

  • mode - this is the whole node. long edge / short edge scale from the image, set size A / set size B just emit fixed values (each has its own width/height pair, so you can toggle between two presets without re-typing).
  • edge_length - the target for the edge modes; 1080 by default.
  • latent_type - the one that bites people. SD3 / Flux / Qwen (16ch) vs SDXL / SD1.5 (4ch). Must match your checkpoint; mismatch the channels and the sampler will reject the latent.
  • round_to - the snap multiple (8/16/32/64/1).

Outputs are width and height (INT) and latent (LATENT). Feed the two ints into an Empty Latent Image's dimensions, or skip that node entirely and use the latent output directly - both work, and both are snapped identically.

Where people get burned

Three traps, all real. First, latent_type must match your model - this is the classic "why is my SDXL workflow failing" moment, and it's a dropdown, not a guess. Second, image is a required input even in set size A/B mode; the node always reads the shape, so you can't leave it unplugged. Third, the snap applies to everything, including your typed set-size values - if you genuinely need an odd exact size, set round_to = 1. And it won't resize your input image; if you wanted the output rescaled, reach for an upscale node instead.

Install

It's a zero-dependency pack - no requirements.txt, no model downloads, no Python packages beyond what ComfyUI already has (torch and comfy.model_management are imported lazily, so the module loads instantly). Easiest path is ComfyUI Manager → Install via Git URL, paste:

https://github.com/normbarrette-arch/ComfyUI-ResizeDimensions

…restart, and it appears under image/size as Resize Dimensions (W/H). Manual install is the same as any custom node:

cd ComfyUI/custom_nodes
git clone https://github.com/normbarrette-arch/ComfyUI-ResizeDimensions.git

then restart ComfyUI.

It's a small pack by a small author (Norm Barrette, MIT licensed) solving exactly one problem. If you keep matching generations to reference images, that problem is worth a node. If you always generate at a fixed size, the built-in Empty Latent Image already does the job - but the empty-latent shortcut and batch support still make it a tidy one-node replacement.

Categoryimage/size

Inputs (10)

NameTypeDefaultDescription
imageIMAGE
modeCOMBO4 options: long edge, short edge, set size A, set size B
edge_lengthINT10801–16384
width_aINT10241–16384
height_aINT10241–16384
width_bINT10241–16384
height_bINT5761–16384
round_toCOMBO85 options: 8, 16, 32, 64, 1
latent_typeCOMBO2 options: SD3 / Flux / Qwen (16ch), SDXL / SD1.5 (4ch)
batch_sizeINT11–4096Number of empty latents in the batch.

Outputs (3)

NameTypeDescription
widthINT
heightINT
latentLATENT