Nodes/ComfyUI-WepeNerd/Resolution Suggest (WepeNerd)
ComfyUI Node

Resolution Suggest (WepeNerd)

A resolution calculator that finally kills the 'not divisible by 64' errors

By WepeNerd·Created 5 months ago·Updated about 17 hours ago· 0
Resolution Suggest (WepeNerd)
    • width
    • height
    • original_width
    • original_height
    • scale_factor
    • aspect_ratio
    • info
    width1920
    height1080
    target1024
    resize_modeLongest Side
    divisor32
    snap_moderound

    Every ComfyUI user has hit it: you type 1340×762 into Empty Latent Image, hit queue, and the sampler either throws a "dimensions not divisible" error or silently gives you a slightly-off latent. Diffusion models were trained at specific resolutions and multiples - Flux wants multiples of 64, SDXL was trained on a short list of specific aspect ratios, and going off-recipe produces stretched bodies and duplicated anatomy. Resolution Suggest (WepeNerd) is a small math node that does the mental work for you: give it a source size and a target, and it returns a clean, divisor-snapped resolution plus the ratio and scale factor.

    It's the kind of node that looks boring until you've rebuilt the same arithmetic in your head for the tenth time. You'll typically wire it in front of an Empty Latent Image or a KSampler's latent input, feeding it the width and height of whatever you're resizing for.

    How it works

    There's no magic here - it's a pure calculator, one of the "Resolution" pair in the WepeNerd pack. It takes a source width/height, proportionally resizes to a target, then snaps both sides down to the chosen divisor grid so every output is cleanly divisible. The actual math lives in a single suggest() function; the node never touches the image itself, just produces numbers.

    The inputs that matter

    • width / height - your source resolution.
    • target - the pixel size you're aiming for. Read the tooltip: in Scale Factor mode this is a percentage, not pixels.
    • resize_mode - Longest Side, Shortest Side, Width, Height, or Scale Factor. Longest Side is the one you'll use 90% of the time: it fits the biggest dimension to the target and preserves the aspect ratio.
    • divisor - the snap grid, 32 by default, with 16, 8, and 64 as options. Start at 32; reach for 64 if you're feeding Flux.
    • snap_mode - round, floor, or ceil. Round is the sane default; floor keeps you from ever exceeding a VRAM budget, ceil guarantees you hit at least the target.

    What comes out

    Seven outputs, but you'll use four: width and height (the snapped INTs that go into your latent), scale_factor (the actual ratio applied, handy if you're also scaling a ControlNet preprocessor to match), and aspect_ratio (a simplified string like "16:9"). original_width and original_height just pass your inputs through, and info is a human-readable summary of everything it did - useful for a Text node when you're documenting a workflow.

    Installing it

    It ships in the ComfyUI-WepeNerd pack, so install once for all four nodes:

    cd ComfyUI/custom_nodes
    git clone https://github.com/WepeNerd/ComfyUI-WepeNerd.git
    cd ComfyUI-WepeNerd
    pip install -r requirements.txt
    

    Or search for WepeNerd in ComfyUI Manager and hit Install. Restart ComfyUI and it appears under WepeNerd/Resolution.

    Common gotchas

    Because it's pure math, there's not much to break - but two things trip people up. First, in Scale Factor mode, target of 150 means "scale to 150%", not "make the longest side 150 pixels"; the tooltip says it, but it's easy to miss. Second, the node is a suggestion, not a guard: wire its outputs to Empty Latent Image yourself. If you'd rather eyeball the size on a draggable box instead of typing numbers, that's exactly what the pack's other resolution node, Drag Resolution, is for.

    CategoryWepeNerd/Resolution

    Inputs (6)

    NameTypeDefaultDescription
    widthINT19201–32768
    heightINT10801–32768
    targetINT10241–32768Target pixel size (or percentage when mode is Scale Factor)
    resize_modeCOMBOLongest Side5 options: Longest Side, Shortest Side, Width, Height, Scale Factor
    divisorCOMBO324 options: 32, 16, 8, 64
    snap_modeCOMBOroundHow to snap to the divisor grid: round (nearest), floor (down), ceil (up)

    Outputs (7)

    NameTypeDescription
    widthINT
    heightINT
    original_widthINT
    original_heightINT
    scale_factorFLOAT
    aspect_ratioSTRING
    infoSTRING