Nodes/comfyui-moonpack/Smart Resolution
ComfyUI Node

Smart Resolution

Pick a preset, let the math hit the model's sweet spot

By moonwhaler·Created about a year ago·Updated 11 days ago· 16
Smart Resolution
    • width
    • height
    • scale
    width1920
    height1080
    preset
    roundingnearest

    Here's a workflow crime most of us commit weekly: you feed a 1920x1080 image into a graph built for SDXL, hit EmptyLatentImage with 1024x1024, and the aspect ratio comes out wrong, or you type 1344x768 and get a resolution the model was never trained on. Smart Resolution exists to kill that class of mistake. Give it a source size and pick a model preset, and it returns the closest model-friendly resolution that preserves the aspect ratio - no calculator, no lookup table.

    The insight behind it is one the community keeps rediscovering: models have a native megapixel budget and a divisor requirement, and deviating from them trades away quality for no reason. This node bakes both facts into presets so you don't have to remember them.

    The inputs that matter

    • width and height - the source aspect ratio you want to preserve. Defaults are 1920x1080; wire these from a Dimension From Image node in a reusable workflow and you never edit them again.
    • preset - the one input that actually matters. It's an enum with six choices, and each one encodes a megapixel budget plus a snapping divisor:
      • SD 1.5 (0.26MP) - the classic 512-based budget.
      • SDXL (1.0MP) - 1024-based, divisor-friendly.
      • Flux (1.0MP) and Flux (1.4MP) - pick by how much VRAM you're willing to spend.
      • Wan 480p (832x480) and Wan 720p (1280x720) - for video models where the resolution matters as much as the aspect.
    • rounding - nearest, floor, or ceil, controlling how it snaps to the preset's divisor. floor guarantees the result stays at or under the budget, which is the safe choice when you're close to a VRAM wall.

    The outputs

    width and height feed straight into an EmptyLatentImage (or a video latent node), and scale is the FLOAT ratio of output to input - handy for driving a denoise strength or for sanity-checking how much you're resizing. That's the whole output set: three numbers, each one useful.

    Installing it

    Standard MoonPack install:

    cd ComfyUI/custom_nodes
    git clone https://github.com/moonwhaler/comfyui-moonpack.git
    

    Or ComfyUI Manager → MoonPack → install, then restart. Under MoonPack/image. No models to download, and the pack has no extra Python dependencies beyond what ComfyUI ships.

    Should you switch?

    If you already have a resolution node you trust, this isn't going to convert you - the genre is crowded and this one doesn't have a killer trick. What it does well is encode the right defaults: the presets are the resolutions people actually run, the rounding is where you want control, and it composes cleanly with MoonPack's Dimension From Image. The use case that sells it is a shared workflow: hand someone the pack, tell them to pick SDXL or Flux, and the graph self-adjusts instead of demanding they know the magic numbers.

    CategoryMoonPack/image

    Inputs (4)

    NameTypeDefaultDescription
    widthINT19201–16384Source width (aspect ratio is preserved).
    heightINT10801–16384Source height.
    presetCOMBOTarget model preset.
    roundingCOMBOnearestHow to snap to the preset's divisor.

    Outputs (3)

    NameTypeDescription
    widthINT
    heightINT
    scaleFLOAT