ComfyUI Node

Image Sizer

The right empty-latent size for your model, without the spreadsheet

By przewodo·Created about a year ago·Updated 4 months ago· 4
Image Sizer
    • Width
    • Height
    model_type
    aspect_ratio_width1
    aspect_ratio_height1
    image_scale1.00

    If you've ever typed a width and height into an Empty Latent node and gotten garbage, you already know the pain: every model family has its own native resolution and pixel budget, and going off it gives you deformed bodies, duplicated anatomy, or a sampler that just refuses. SD wants 512-based, SDXL 1024-based, Wan 720p is 1280×720, LTX-2 has its own square-ish constraints. Memorizing all of them is a fool's errand. This node is the shortcut: tell it which model you're building for, pick an aspect ratio, and it hands back a width and height sized correctly for that model's total pixel count.

    Wire its two outputs straight into the width and height of an Empty Latent (or into a video sampler's resolution), and the math - pixel budget, aspect ratio, even the model-specific divisibility rules - is done for you.

    How it works

    The mechanism is a table lookup plus some geometry. Each model_type has a baked-in total pixel budget, straight from the code:

    • SD 512×512, SDXL 1024×1024
    • Wan 480p 832×480, Wan 720p 1280×720
    • Flux Kontext 1024×1024, Flux 1D 1536×1536
    • Qwen Image 3584×3584 (rounded to multiples of 28)
    • LTX-2 480p / 720p / 1080p - square bases of 480 / 720 / 1080, where the smaller side is pinned to the base and the larger side extends per your aspect ratio.

    You give it aspect_ratio_width and aspect_ratio_height (like 16 and 9), it computes width and height that hit that ratio while staying at (or under) the model's pixel count, and then applies the model-specific rounding rules - Qwen multiples of 28, LTX-2 ensures the long side stays even. The image_scale input is a pixel budget multiplier: 1.0 uses the full budget, 0.5 halves the total pixels (so linear dimensions shrink by the square root - a subtlety that catches people).

    The inputs that matter

    • model_type - the 10-option dropdown. This is the one that decides everything.
    • aspect_ratio_width / aspect_ratio_height - your desired ratio (default 1:1).
    • image_scale - overall size as a fraction of the model budget, 0.01 to 1.0.

    Outputs: Width and Height as INTs.

    Installing it

    Part of ComfyUI-Przewodo-Utils. Manager → search the pack, or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/przewodo/ComfyUI-Przewodo-Utils.git
    

    Restart. It's pure Python math - no extra deps.

    Where people get tripped up

    The image_scale trap is the one that bites: because it scales pixels, 0.5 doesn't mean "half the width" - it means about 70% of the width. If you want a specific fraction of the linear dimensions, do that math yourself and feed the pixel multiplier accordingly.

    Second, model-specific rules are uneven. The LTX-2 modes pin the smaller side and grow the long side; the "Kontext" modes are square-ish. If the node hands you a dimension your model's VAE doesn't accept (Wan VAEs compress 4× per axis and often want multiples of 8 or 16), you may still need to round - this node is "right-sized," not "guaranteed divisor-friendly." Check the number before you blame a blank latent.

    CategoryPrzewodoUtils

    Inputs (4)

    NameTypeDefaultDescription
    model_typeCOMBOModel type that determines the base resolution and total pixel count. Each model has optimized dimensions: SD (512x512), SDXL (1024x1024), Video 480p (832x480), Video 720p (1280x720), Flux Kontext (1024x1024), Flux 1D (1536x1536).
    aspect_ratio_widthINT1Width component of the desired aspect ratio. Combined with aspect_ratio_height to calculate the final dimensions while maintaining the model's total pixel count.
    aspect_ratio_heightINT1Height component of the desired aspect ratio. Combined with aspect_ratio_width to calculate the final dimensions while maintaining the model's total pixel count.
    image_scaleFLOAT1.000.01–1Scale factor to apply to the final image dimensions.

    Outputs (2)

    NameTypeDescription
    WidthINT
    HeightINT