Nodes/Resolution Calculator by Steve Lasmin/Resolution Calculator by Steve Lasmin
ComfyUI Node

Resolution Calculator by Steve Lasmin

Stop doing aspect-ratio math in your head

By Eklipsis·Created 4 months ago·Updated about a month ago· 0
Resolution Calculator by Steve Lasmin
    • width
    • height
    • preview
    resolution1024
    aspect_presetcustom
    width_ratio2
    height_ratio3
    multiplier32

    Every architecture has a native resolution, and every resolution has to be divisible by the model's block size - 8 for the VAE latent, 64 for Flux. Get either wrong and you get warnings, tiled patterns, or a final image that isn't the 16:9 you asked for. Resolution Calculator by Steve Lasmin is a tiny utility that does that arithmetic for you: you type a maximum dimension and an aspect ratio, it hands back exact width and height integers that are safe to drop straight into an Empty Latent Image node.

    It's not doing anything clever - that's the point. It's a fancy calculator, the kind of node you wire into a workflow once so you can tweak "resolution" as a single number instead of editing two dimensions and hoping they stay in ratio.

    How it works

    The node takes your aspect ratio (as width:height), works out which side is the long one, and treats your resolution number as the longest side. The other side is derived from the ratio, then both get rounded to the nearest multiple of the multiplier you picked, floored at one multiplier minimum.

    One honest gotcha before you trust the README: it calls resolution "total pixels" and shows a worked example (1024, 16:9, 32 → 1088×608) that the actual code does not produce. The shipped code treats the number as the longest side, so that same input comes out 1024×576. Trust the node, not the README's arithmetic.

    There's one more subtlety worth knowing: rounding to the nearest multiple means the output isn't always pixel-perfect to your ratio. For 16:9 and a 32 multiplier the math lands clean, but a weird ratio like 21:9 at a low resolution can drift a little. That's the price of guaranteed divisibility, and it's the right trade.

    The inputs that matter

    • resolution - the target longest side in pixels. Default 1024, and that's a sane place to start for SDXL.
    • aspect_preset - a dropdown with the usual suspects: 1:1, 3:2, 4:3, 16:9, 16:10, 21:9, and their portrait rotations. Pick one and it overrides the manual ratios below. Leave it on custom and the width_ratio / height_ratio integers do the talking (default 2:3).
    • multiplier - 16, 32, or 64. Default 32 is right for SD1.5 and SDXL. Switch to 64 for Flux - Flux wants multiples of 64, and this is the whole reason that option exists.

    Three outputs: width and height as integers (wire them into Empty Latent Image's inputs, or into image-resize nodes), plus a preview string that summarizes what it calculated - handy to pipe into a text display node so you can see the result without squinting at your graph.

    Installing it

    No dependencies, no model downloads, nothing to download after the clone. Either grab it through ComfyUI Manager (search "Resolution Calculator by Steve Lasmin"), or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/Eklipsis/resolution_calculator_by_steve_lasmin.git
    

    Then restart ComfyUI. The node shows up under utils. That's the entire install - this one is about as low-friction as custom nodes get.

    Where it fits

    Honestly, this is a "nice to have" more than a "must have." If you already run a resolution math node from rgthree or ComfyMath, you don't need this one too. But if you're starting from a stock ComfyUI install and you're tired of typing 1344×768 one day and 1216×832 the next, it's a clean one-node answer, and it beats hand-rolling the calculation because it guarantees the divisibility that stops Empty Latent Image from snapping your carefully chosen dimensions to something you didn't pick. Just remember the author licenses it CC BY-ND - fine to use and share, but no remixing without permission.

    Categoryutils

    Inputs (5)

    NameTypeDefaultDescription
    resolutionINT102432–4096
    aspect_presetCOMBOcustom11 options: custom, 1:1, 3:2, 4:3, 16:9, 16:10, +5
    width_ratioINT21–999999
    height_ratioINT31–999999
    multiplierCOMBO323 options: 16, 32, 64

    Outputs (3)

    NameTypeDescription
    widthINT
    heightINT
    previewSTRING