Scale (Best-Res)
Give me 1.5x of this, rounded so the VAE won't complain
- width
- height
- scale
This is the pack's pocket calculator. You have a width and height - from a previous node, a workflow default, whatever - and you want them scaled by a uniform factor, but the result has to stay a multiple of your step so the latent doesn't break. Scale (Best-Res) multiplies, rounds, and hands you back clean integers plus the factor it actually used.
The best resolution nodes in this pack (area, ratio) are about choosing a resolution from scratch. This one is the companion for transforming one you already have: the "what does 1.5x of 1024x768 look like when it has to stay divisible by 48?" step.
How it works
Straightforward math, then the pack's rounding. It takes width × height, multiplies both by scale (or divides, if you flip direction), and rounds the result to the nearest pair that's divisible by step while keeping the aspect ratio as close to the original as possible. It uses the same 3-pass "closest to the desired ratio" routine as the whole pack, so the rounding is never done naively on each axis independently - the pack tries a few candidate pairs and keeps the best.
The scale output returns the actual scale factor that was applied, which is worth grabbing if you flipped direction to "scale down": it gives you the real inverse factor, not the one you typed.
The inputs
width,height- the resolution you're scaling from. Inputs are INTs, so feed them from a previous Best-Res node, anImage Sizenode, or a primitive.step- divisibility requirement. Note this node's default is 8, not the 48 used by the resolution-choice nodes. That's deliberate: this is the "I just need it legal for the VAE" node. If you're planning further upscales, raise it to 48 (or 144) so the chain stays clean - that's the pack's whole philosophy of planning ahead.scale- the factor. Default 1.5.direction- ON means "res × scale" (upscale), OFF means "res ÷ scale" (i.e., specify how much to scale down by). The tooltip explains it: sometimes it's easier to say "I want this halved" than "I want this × 0.5."
Outputs: width, height (rounded INTs) and scale (the FLOAT that was actually used).
Why you'd reach for it
The classic case is a two-pass hi-res fix where you already have the initial resolution wired up and you want the second pass to be 1.5x of it - not 1.5x of it then a manual crop when the VAE rejects the number. Instead of typing "1536" and hoping, you chain this node: init resolution → Scale → clean HD dimensions → second KSampler. It's also handy as a pure utility for scaling numbers that never touch a latent at all; like every node in this pack, it's math-only and model-agnostic.
If you're choosing the initial resolution too (rather than transforming an existing one), you're probably better off with Best-Res (area+scale) - it plans init and upscaled sizes together so both stay step-clean. This node is the simpler, single-step version.
Install
cd ComfyUI/custom_nodes
git clone https://github.com/Lex-DRL/ComfyUI-BestResolution
or find "Best Resolution" in ComfyUI Manager, install, restart. The only dependency is frozendict; there are no model files to download. It's a number-cruncher, and a dependable one - the rare node where the output being boring is the whole appeal.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| width | INT | 10241–9223372036854776000 | — |
| height | INT | 10241–9223372036854776000 | — |
| step | INT | 81–9223372036854776000 | — |
| scale | FLOAT | 1.50 | — |
| direction | BOOLEAN | true | Sometimes it's easier to specify scale by it's inverse: how much to scale DOWN by. This toggle controls that. |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| width | INT | — |
| height | INT | — |
| scale | FLOAT | — |