Better Image Dimensions_v2
Better Image Dimensions_v2
- width
- height
Type a width and height, pick a ratio, and this node snaps the pair together so the composition stays the shape you want. Better Image Dimensions_v2 is the versatile one in this pack - the node that lets you say "I want 1024 wide at roughly a 9:16 feel" and get a pair of numbers that actually respect both constraints.
It's also the node with history. The original Better Image Dimensions was one of the first well-known dimension utilities for ComfyUI, built back in mid-2024 by the author of the upstream pack to solve a problem he kept hitting in his own workflows. The exact use case that made it click: you load a reference image into a ControlNet or IPAdapter, and you want your generation to match that image's ratio without doing ratio arithmetic by hand. You feed in a width, pick the ratio, and the node derives the matching height. This _v2 version is that same logic, kept alive in a fork that also grew Wan video presets.
How it works
The mechanism is honest integer math. You pick one dimension to enforce - that's the side that stays exactly as you typed it - and the node divides it by the matching side of your chosen ratio to get a scale factor, then multiplies the other ratio side by that factor. Enforce width at 1024 with 2:3 and you get 1024×1536. Enforce height at 1024 with the same ratio and you get 682×1024.
Two details worth knowing. First, it uses integer (floor) division, so the derived side never overshoots your enforced dimension's implied scale - it can come out a hair small, never too big. Second, the ratio math doesn't align to 8. Enforce 1024 wide at 7:9 and you get 1024×1314, which is not a multiple of 8. Diffusion latents (Wan's especially) are happiest on 8-aligned dimensions, so if you're feeding the result into a latent, round it up with a math node or just pick a preset that's already aligned.
The inputs that matter
Five inputs, and honestly only two of them are doing real work:
- width and height - INTs, default 1024, range 64 to 2^20, stepping by 2. These are your starting point. Only one of them survives unchanged, depending on
enforce_dimension. - ratio - ten options, from
Custom(which bypasses all ratio math and just outputs your width and height as typed) through 1:1, 2:3, 4:5, 4:7, 5:12, 7:9, 9:16, 9:21, 13:19. - enforce_dimension -
widthorheight. The side that stays fixed while the other adapts. - order - swap the output pair for portrait without rewiring anything.
Outputs are width and height, both INT, wired anywhere a resolution is expected - EmptyLatentImage, sampler resolution inputs, whatever.
The catch
The default width/height of 1024 with Custom ratio is the "just pass my numbers through" mode, which is handy but also a trap if you forget you're in it: you'll wonder why the ratio dropdown isn't doing anything. And remember this node has no model-awareness at all - it doesn't know whether 1024 is a good SDXL number, a terrible SD 1.5 number, or a Wan number. It's a pure geometry tool; you supply the sensible base.
Install
The same light install as every node in this pack - single Python file, no dependencies, no requirements.txt, no model downloads.
Via ComfyUI Manager: search ComfyUI-Better-Dimensions-wan-v2, install, restart. Or:
cd ComfyUI/custom_nodes
git clone https://github.com/neo-editer/ComfyUI-Better-Dimensions-wan-v2
and do a full ComfyUI restart.
One trap: the README in the repo is inherited from upstream and still points at the original corbin-hayden13/ComfyUI-Better-Dimensions.git clone URL. That installs the old pack, which has this node but none of the Wan presets. Use the URL above.
Verdict
If you only install one node from this pack for still-image work, this is the one - it's the general-purpose ratio solver. Just keep the 8-alignment caveat in mind when you're feeding its output into a video latent.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| width | INT | 102464–1048576 | — |
| height | INT | 102464–1048576 | — |
| ratio | COMBO | 10 options: Custom, 1:1, 2:3, 4:5, 4:7, 5:12, +4 | |
| enforce_dimension | COMBO | 2 options: width, height | |
| order | COMBO | 2 options: default (width,height), swapped (height,width) |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| width | INT | — |
| height | INT | — |