Nodes/ComfyUI-ResolutionHelper/Resolution from Scanlines
ComfyUI Node

Resolution from Scanlines

Resolution from Scanlines

By AlfredSartan572·Created 22 days ago·Updated about 7 hours ago· 1
Resolution from Scanlines
    • width
    • height
    • longest
    • megapixels
    ◄aspect_ratio▾►
    ◄scanlines▾►
    ◄multiple32►

    Why you'd want this

    "Scanlines" is old television jargon for the horizontal lines in a frame, which is where 720p and 1080p get their names. The author is leaning on that on purpose: this node is the one you reach for when you're thinking like a video person.

    Which is most of the time now. If you're running LTX, Wan or MiniMax H3, or you're just making shorts and verticals, you already think in 720p and 1080p, not in megapixels. And you have a second problem the image crowd doesn't: you need the same render at 16:9 for a test and at 9:16 for the actual upload, without one of them costing meaningfully more VRAM than the other. Recomputing dimensions by hand for every one of those combos is exactly the fiddle this node removes.

    What it actually does differently

    Same six lines of flooring arithmetic as its sibling, with one twist that makes it a genuinely different tool:

    pixels = size * size * 16 / 9      # the pixel budget of a 16:9 frame this tall
    width  = floor( sqrt(pixels * aspect_w / aspect_h) / step ) * step
    height = floor( (width * aspect_h / aspect_w) / step ) * step
    

    Read what pixels is doing. "1080p" is converted to a pixel count - 1080² × 16/9, the area of a 1920x1080 frame - and only then shaped to the aspect ratio you picked. So the scanline value sets a budget, and the aspect ratio sets the shape, independently. Pick 720p with 9:16 and you don't get 720p anything: you get 704x1248, a portrait frame holding the same ~0.88 MP as 1280x720. That's the whole point of the node. Same cost, different orientation.

    Watch the budgets: 480p is 0.39 MP, 1080p about 1.98 MP, 1440p 3.5 MP. 768p is the sane choice if your model is happiest near a megapixel.

    Inputs and outputs

    • aspect_ratio - the same 15 presets the pack uses everywhere: 32:9 through 1:1 through 9:32, all rotations spelled out.
    • scanlines - 12 choices, 240p, 360p, 480p, 544p, 640p, 720p, 768p, 864p, 1024p, 1080p, 1200p, 1440p. These are labels attached to a height in lines; there's no way to type a custom one, so if you need 900p you're improvising.
    • step - default 32, range 1 to 112, and the tooltip is the author's own recommendation: "MiniMaxH3=32, Illustrious/Pony=64, other=16". For video work, 32 is usually the one you want.

    Four outputs: width, height, longest (all INT), plus megapixels (FLOAT). Width and height go to your latent or video latent node. longest feeds anything asking for the long edge. And megapixels is the useful odd one out - it's a total-pixel budget as a float, so you can right-click the megapixels widget on something like a scale-to-total-pixels node, convert it to an input, and let this node decide your pixel count in one place.

    The trap: your 1080p won't be 1080p

    This is the thing to know before you file a bug. At the default step of 32, the standard video heights get chopped, because they aren't multiples of 32:

    | You picked | You get | Lines lost | |---|---|---| | 480p | 832x448 | 32 | | 720p | 1280x704 | 16 | | 1080p | 1920x1056 | 24 | | 1440p | 2560x1440 | 0 |

    1440p survives untouched (1440 is 45 × 32). 1080p does not. Neither the width nor the height is rounded up, only down, so you always come in under. Also note the megapixels output reflects the un-rounded target - it reads 1.98 for 1080p while the actual 1920x1056 render is 1.93 MP. It's the budget, not the result.

    The fix depends on what you're feeding:

    • Encoding a plain video, model doesn't care - set step to 8. 1920 and 1080 are both divisible by 8, so 1080p comes out as literal 1920x1080, ready for h264 without a pad filter.
    • The model demands 32 - keep step at 32 and be glad. LTX-2.3 requires width and height divisible by 32 and fails on off-grid values rather than rounding them for you; similar hard constraints show up across current video architectures. Handing it 1920x1056 is doing yourself a favour.

    Installing it

    Non-negotiable first step for any custom node: ComfyUI Manager, search ResolutionHelper or ComfyUI-ResolutionHelper, install, restart ComfyUI. By hand:

    cd ComfyUI/custom_nodes
    git clone https://github.com/AlfredSartan572/ComfyUI-ResolutionHelper
    # restart ComfyUI
    

    No requirements.txt, no pip installs, no model files. The pack's entire import list is Python's built-in math. Nodes appear under Resolution Tools.

    There's almost no community footprint for this pack yet - it's new, one author, Registry-published in late September 2026. The saving grace is scale: a couple hundred lines of arithmetic with zero dependencies, so open resolution_nodes.py, read it in five minutes, and know exactly what you installed.

    Other things that bite

    Video latents still need matching frame counts. This node gives you width and height. LTX-family models also want frame count divisible by 8 plus 1, and it has no opinion about frames at all - that's on you or on a frame-count node.

    Aspect ratio doesn't change the pixel budget, so vertical isn't free. 9:16 at 1080p is 1056x1856, which is nearly two megapixels of work and roughly the same render time as the landscape version. If you assumed verticals were cheaper, that's why your queue got slower.

    The ratio list is fixed. No 7:4, no weird custom ratio. For anything exotic you're back to typing numbers into an Empty Latent Image, which is what this pack exists to spare you from - mostly.

    CategoryResolution Tools

    Inputs (3)

    NameTypeDefaultDescription
    aspect_ratioCOMBO15 options: 32:9 (Super Ultrawide), 21:9 (Ultrawide), 16:9 (Widescreen), 16:10 (WUXGA), 5:4 (5:4 Standard), 4:3 (Standard), +9
    scanlinesCOMBO20 options: 240p, 360p, 480p, 544p, 640p, 720p, +14
    multipleINT321–112MiniMaxH3=32, Illustrious/Pony=8, other=16

    Outputs (4)

    NameTypeDescription
    widthINT—
    heightINT—
    longestINT—
    megapixelsFLOAT—