Nodes/Boyonodes/Boyo Resolution Calculator
ComfyUI Node

Boyo Resolution Calculator

Width In, Matching Height Out — Always Divisible by 8

By DragonDiffusionbyBoyo·Created 2 years ago·Updated 26 days ago· 16
Boyo Resolution Calculator
    • width
    • height
    width512
    aspect_ratio1:1

    Every time you switch orientation in a workflow, you do the same dance: pick a base width, multiply it by the aspect ratio, round the result to a multiple of 8, and hope the numbers still make the latent cleanly divisible. BoyoResolutionCalc removes the dance. Give it a width and an aspect_ratio, and it returns the width and height pair, both snapped to the nearest multiple of 8. That's it - and honestly, for most workflows, that's all you need.

    The aspect dropdown covers the practical menu: 1:1 Square, 4:3, 3:2, 16:9 HD, 21:9, 2:3, 3:4, and 9:16 Tiktok-Shorts. The width input spans 64–2048 in steps of 8.

    Why the multiple-of-8 rule matters

    Latent diffusion models downscale images through the VAE by 8x per side, so a resolution that isn't divisible by 8 produces mismatched latent dimensions - the kind of error that shows up as a cryptic shape mismatch halfway through a render, or forces the model to pad. Nodes like Empty Latent Image, and video models especially, are unforgiving here. A calculator that quietly guarantees the constraint saves you from the whole class of "why won't this run at 768x1024" problems.

    How it works under the hood

    The node rounds the width up to a multiple of 8, derives the height from the ratio, rounds that too, then re-derives the width from the rounded height to keep the aspect ratio exact. So you can rely on the output pair being both divisible by 8 and actually the ratio you asked for - which sounds like a low bar until you've used a calculator that rounds one dimension and quietly bends the ratio.

    Where it fits

    Wire the two INT outputs straight into an Empty Latent Image (or a video latent node) whenever you're setting up a generation at a non-square orientation. Because it's a plain integer pair, you can also drive it from a loop to sweep through aspect ratios across a batch - same seed, different framing, automatically.

    Installing it

    Part of the Boyonodes pack (DragonDiffusionbyBoyo):

    cd ComfyUI/custom_nodes
    git clone https://github.com/DragonDiffusionbyBoyo/Boyonodes
    

    Restart ComfyUI, or install "Boyonodes" via ComfyUI Manager. Zero extra dependencies - pure integer math.

    Gotcha

    • It only computes from a width. There's no "given a height, find the width" mode, so if you think in heights, flip the ratio mentally (2:3 vs 3:2) and feed the corresponding width.

    If you have a preferred aspect-ratio preset node already, this one's a lateral move. If you've been hand-computing 16:9 at 512 width one too many times, this is the node you'll stop noticing because it just works.

    CategoryBoyonodes

    Inputs (2)

    NameTypeDefaultDescription
    widthINT51264–2048
    aspect_ratioCOMBO1:18 options: 1:1 Square, 4:3, 3:2, 16:9 HD, 21:9, 2:3, +2

    Outputs (2)

    NameTypeDescription
    widthINT
    heightINT