Nodes/Best Resolution/Best-Res (area)
ComfyUI Node

Best-Res (area)

The most efficient way of selecting an optimal resolution: image size selected indirectly - by the total desired resolution (area) + aspect ratio. Desired resolution (aka image area/megapixels/pixel count) is specified with a side of a square image. This isn't accidental: most models disclose what image resolution they're trained on, and usually they're square: - SD 1.5 - 512x512 pixels - SDXL - 1024x1024 pixels By simply providing this single number and setting your aspect ratio/orientation, you get the width and height to produce the closest total resolution to the training set, while also respecting image proportions and step-rounding.

By Lex-DRL·Created about a year ago·Updated 4 months ago· 14
Best-Res (area)
    • width
    • height
    square_size1024
    step48
    landscapetrue
    aspect_a16
    aspect_b9
    CategoryBest Resolution

    Inputs (5)

    NameTypeDefaultDescription
    square_sizeINT10241–9223372036854776000The total resolution of the image would be the same as of a square with this side. The width and height would be such to respect aspect ratio, but also be as close as possible to the total number of pixels as in this square image. - 512x512 square (SD 1.5): ~0.25 megapixels - 1024x1024 square (SDXL): ~1 megapixel
    stepINT481–9223372036854776000Both width and height will be divisible by this value - by rounding them to the closest appropriate resolution. The default 48 is (8 * 3 * 2), so it's a safe choice because: - it's compatible with SD1.5/XL downsampling factor (divisible by 8), - it can be upscaled by x1.5 or x1.333 at the first iteration, which is optimal for latent-upscale, - after x1.5 upscale, if you only do x2 later (it's OK for already high resolutions) - it will be divisible by 3 AND 9, which might become handy at that point, where you'll probably use UltimateSDUpscale. Other values worth trying first: 64, 96, 128.
    landscapeBOOLEANtrueSpecifies image orientation: When ON, width is bigger (image is horizontal). When OFF, height is bigger (image is vertical).
    aspect_aFLOAT16Two aspects together define an aspect ratio (16:9, 4:3, etc). Order doesn't matter: image orientation is defined by the 'landscape' toggle. The specified aspect ratio is APPROXIMATE: step parameter has priority over the exact image proportions.
    aspect_bFLOAT9Two aspects together define an aspect ratio (16:9, 4:3, etc). Order doesn't matter: image orientation is defined by the 'landscape' toggle. The specified aspect ratio is APPROXIMATE: step parameter has priority over the exact image proportions.

    Outputs (2)

    NameTypeDescription
    widthINT
    heightINT