Nodes/EmberFrame Nodes/EmberFrame MP Aspect Resolution Selector
ComfyUI Node

EmberFrame MP Aspect Resolution Selector

A resolution picker that does the mental math for you

By emberframe·Created 3 months ago·Updated 3 months ago· 0
EmberFrame MP Aspect Resolution Selector
    • width
    • height
    • actual_megapixels
    aspect16:9
    orientationauto
    megapixels2.00
    align64
    prioritybalanced
    search_steps24

    The EmberFrame MP Aspect Resolution Selector is the node you use when you're tired of typing "1216 x 832" and hoping. It takes a target aspect ratio and a target megapixel count, then hands you back a width and height that are actually aligned for the model - multiples of 64 by default, so you're not feeding ComfyUI some orphan dimension that the model has never seen before.

    The name looks weird. The "MP" is megapixels and the "64" is just the default alignment - the class name is a relic of the older mp_aspect_res_selector pack this replaces. The node itself lets you set align anywhere from 8 to 256.

    Why you'd reach for it: modern flow-matching models like Z-Image have a native ceiling around 1–2MP. Pushing past ~2MP produces artifacts instead of detail - the community rule of thumb is to generate small and upscale later, not to inflate the latent. This node is how you nail "give me a 2 megapixel image at 3:2" without a calculator. It's what the EmberFrame example Z-Image workflows use to size their empty latent.

    How it works

    Give it a ratio, an orientation, and a target area. It computes the ideal dimensions (sqrt(area / (w_ratio * h_ratio))), snaps both sides to your align value, then does a small search around that point scoring each candidate on how close it is to your target area and your target aspect. The priority slider decides which error matters more - balanced, area, or aspect - and search_steps sets how far around the ideal point it looks.

    The two inputs that actually matter:

    • aspect - pick from 1:1, 2:1, 3:2, 4:3, 5:4, 16:9, 21:9. If you don't see your ratio, you're out of luck; this is a picker, not a solver.
    • megapixels - 0.25 to 4.0. For Z-Image, 1.5–2 is the sweet spot.
    • orientation - auto respects the ratio as written, portrait/landscape swaps the axes if you'd rather think in orientation than numbers.

    Outputs are width and height (INT) plus actual_megapixels (FLOAT) so you can see what the snapping actually bought you. Wire width/height straight into EmptyLatentImage or a ImageScale node.

    Install

    This node ships in the EmberFrame Nodes pack, installed like any custom node:

    cd ComfyUI/custom_nodes
    git clone https://github.com/emberframe/emberframe-nodes.git
    

    Restart ComfyUI and you'll find it under EmberFrame → Resolution. It's also on the Comfy registry as emberframe/emberframe-nodes if you use Manager - though the pack is young (v1.0.2), so the git-clone route is the one that never surprises you. No models, no extra dependencies. This pack is genuinely zero-dep: nothing but ComfyUI's own torch.

    Gotchas

    Don't expect actual_megapixels to equal your target exactly. It can't - alignment snapping wins, and the search picks the nearest aligned candidate, which is exactly what you want for a model that was trained on 64-multiple resolutions. Also, 4 megapixels at the top of the slider is a big ask for a 1–2MP-native model; if your output starts looking like a smeary mess at 4MP, the resolution isn't the bug, the model ceiling is.

    One more thing worth knowing: ComfyUI's stock EmptyLatentByRatio does the same broad job, but it stops at the ratio - it won't hit a specific megapixel area, honor an alignment, or let you weight aspect vs. area. If your workflow is "I know how many pixels I want," this is the nicer tool.

    CategoryEmberFrame/Resolution

    Inputs (6)

    NameTypeDefaultDescription
    aspectCOMBO16:97 options: 1:1, 2:1, 3:2, 4:3, 5:4, 16:9, +1
    orientationCOMBOauto3 options: auto, portrait, landscape
    megapixelsFLOAT2.000.25–4
    alignINT648–256
    priorityCOMBObalanced3 options: balanced, area, aspect
    search_stepsINT244–200

    Outputs (3)

    NameTypeDescription
    widthINT
    heightINT
    actual_megapixelsFLOAT