Nodes/Y7Nodes for ComfyUI/Y7 Resolution Selector
ComfyUI Node

Y7 Resolution Selector

The resolution calculator with the fine megapixel knob you didn't know you wanted

By yushan777·Created about a year ago·Updated a day ago· 8
Y7 Resolution Selector
    • width
    • height
    aspect_ratio1:1 (Square)
    megapixels1.00
    multiple8

    Y7 Resolution Selector is the "I want a 1-megapixel image, 16:9, figure out the rest" node. You pick an aspect ratio, dial in a total pixel budget, and it hands you a width and height (as INTs) that you wire straight into an Empty Latent Image. If you've ever typed 1344×768 into a dimensions box by hand and hoped, this is the node that does the math instead of your calculator app.

    Full honesty up front: this is a clone of the built-in ComfyUI ResolutionSelector (V3) node. The author says so right in the source. The only two differences are a finer megapixels step (0.01 instead of the built-in's 0.1) and the computed resolution printed on the node face after you run it. So if you're already happy with the built-in's 0.1 MP increments, you don't need this - but the finer step is the whole point, and it's why the thing exists at all.

    How it works

    The math is boring in the best way. It converts your megapixel target to raw pixels (megapixels × 1024 × 1024), finds the scale that makes width × height land on that total for your chosen ratio, then rounds each side down to the nearest multiple:

    total_pixels = megapixels * 1024 * 1024
    scale = sqrt(total_pixels / (w_ratio * h_ratio))
    width  = round(w_ratio * scale / multiple) * multiple
    height = round(h_ratio * scale / multiple) * multiple
    

    That rounding step matters more than it looks. Diffusion models live in a latent space that wants dimensions divisible by 8 (or 64 for Flux), and generating at off-multiple sizes is how you get the smeared or doubled anatomy that fills every troubleshooting thread. The multiple default of 8 is fine for most things; bump it to 16 or 64 if your model demands it.

    The inputs that matter

    • aspect_ratio - a dropdown of the usual suspects: 1:1, 2:3, 3:2, 3:4, 4:3, 9:16, 16:9, and 21:9. Pick the shape; the node does the rest.
    • megapixels - your total pixel budget, 0.1 to 16.0 MP. The 0.01 step is the star of the show here. The author built it to land on MiniMax H3's recommended ~0.98 MP (1344×768) target, which the built-in's chunky 0.1 increments simply can't reach - 0.9 MP and 1.0 MP are on opposite sides of it. At 1.0 MP square you get exactly 1024×1024; at 16:9 you get 1368×768, which is the nearest multiple-of-8 fit to a true megapixel.
    • multiple - snaps both dimensions to a multiple of this (8–128, default 8). Leave it alone until a model tells you otherwise.

    Both outputs are INTs: width and height. They feed the width/height inputs of Empty Latent Image, or any other node that wants explicit dimensions - a VAEEncode sizing an img2img input, an ImageScale target, that kind of thing. No images pass through here; it's pure numbers.

    Installing it

    It ships inside the Y7Nodes pack, so you get the whole utility drawer whether you want it or not:

    • ComfyUI Manager → Custom Nodes Manager → search "Y7" or "Y7Nodes" → Install → restart.
    • Or manually: cd ComfyUI/custom_nodes && git clone https://github.com/yushan777/ComfyUI-Y7Nodes, then pip install -r requirements.txt and restart.

    Fair warning: that requirements file pulls in transformers, sentencepiece, and the lmstudio SDK for the pack's other nodes. This node itself is pure Python math with zero dependencies and zero model downloads - nothing to configure, nothing to fetch.

    Gotchas

    The main one is expectation management: because of the rounding, the actual megapixels you get won't be exactly what you typed. That's normal and fine - the "multiple" snap is what keeps the output on-model. And don't expect it to tell you the best resolution for your model; it'll happily hand you 16:9 at 16 MP if you ask, and your GPU will have opinions about that. It's a calculator, not a referee. For the "which resolutions actually work" question, your model's native band (roughly 1–2 MP for most current generation) is the real constraint - this node just stops you from guessing the math.

    CategoryY7Nodes/Utils

    Inputs (3)

    NameTypeDefaultDescription
    aspect_ratioCOMBO1:1 (Square)The aspect ratio for the output dimensions.
    megapixelsFLOAT1.000.1–16Target total megapixels. 1.0 MP ≈ 1024x1024 for square.
    multipleINT88–128Nearest multiple of the result to set the selected resolution to.

    Outputs (2)

    NameTypeDescription
    widthINTCalculated width in pixels multiplied by the selected multiple.
    heightINTCalculated height in pixels multiplied by the selected multiple.