ComfyUI Node

Image Params

Pick a ratio, get width, height, and megapixels for free

By Fictiverse·Created 3 years ago·Updated 17 days ago· 27
Image Params
    • _
    base768
    ratio
    orientationfalse
    hires2.00
    batch1

    Image Params is a resolution calculator you operate by picking a ratio. You set a base size - say 1024 for SDXL-class work or 768 for a lighter model - choose an aspect ratio from a dropdown (1:1, 5:4, 4:3, 3:2, 16:9, 2:1, 21:9, 32:9), pick landscape or portrait, and the node hands you a bundle containing the width, height, hires multiplier, batch size, and total megapixels for that combination.

    The whole point is to stop doing resolution math in your head. "What's 16:9 at roughly 1 megapixel?" is a question ComfyUI users ask constantly, and the answer isn't a round number - 1024×576 is 0.59 MP, 1344×768 is 1.03 MP, and which one you want depends on the model. This node computes it, keeps the numbers on the divisibility grid the latent space expects, and reports the megapixels so you know what you're actually asking the GPU to do.

    Like its sibling Essential Params, it's a packet node: the outputs come out as a single IParams bundle, and you unpack it with the pack's Image Params Expand node, which turns it into individual width, height, hires ratio, batch size, and Megapixels sockets you can wire into an Empty Latent Image and a KSampler.

    How it works

    The math is straightforward: it takes your base as the reference dimension, applies the ratio, and computes width and height such that the area is roughly base². Both dimensions are floored down to the nearest multiple of 64, which keeps everything latent-friendly for SD-lineage models. It also reports the actual megapixel count (base² / 1,000,000) so you can sanity-check the load.

    A couple of behaviors to know:

    • orientation flips the result - off is landscape, on is portrait. Simple.
    • hires isn't folded into the main width/height; it's carried along as a separate multiplier (default 2×) for the hires pass, letting a downstream node scale up from the base dimensions. It doesn't change the width/height outputs.
    • batch is likewise carried as-is, ready to feed a sampler's batch count.

    Inputs and outputs

    • base (INT, 128–4096, step 128) - the reference resolution. Default 768.
    • ratio - the 8-way aspect dropdown.
    • orientation (BOOLEAN) - landscape (off) / portrait (on).
    • hires (FLOAT, 1–8) - hires multiplier, carried in the packet.
    • batch (INT, 1–64) - batch size, carried in the packet.

    Output:

    • _ (IParams) - the bundle. Unpack with Image Params Expand.

    Installing it

    Ships in ComfyUI Fictiverse Nodes. ComfyUI Manager → search "ComfyUI Fictiverse Nodes" → install → restart, or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/Fictiverse/ComfyUI_Fictiverse
    

    No dependencies, no models - pure math. Apache 2.0.

    Common issues

    Pack gotcha: ModuleNotFoundError: No module named 'custom_nodes.ComfyUI_Fictiverse' means the folder isn't named exactly ComfyUI_Fictiverse; rename and restart.

    Node-specific, two things. First, the packet is only meaningful to the Expand node - you can't plug an IParams wire straight into an Empty Latent Image. If a downloaded workflow has an IParams dangling, that's the missing Expand half. Second, remember the 64-multiple flooring: the "exact" ratio you asked for is approximated downward, so 16:9 at base 1024 won't be precisely 16:9 - it'll be the nearest 64-multiple below. That's what the sampler actually wants, so it's a feature, but it's why the reported megapixels are a touch under your nominal base.

    CategoryFictiverse/Params

    Inputs (5)

    NameTypeDefaultDescription
    baseINT768128–4096
    ratioCOMBO8 options: 1:1, 5:4, 4:3, 3:2, 16:9, 2:1, +2
    orientationBOOLEANfalse
    hiresFLOAT2.001–8
    batchINT11–64

    Outputs (1)

    NameTypeDescription
    _IParams