ComfyUI Node

Resolution Helper

Stop hand-computing 4K dimensions

By FloyoAI·Created 12 months ago·Updated 8 months ago· 6
Resolution Helper
    • width
    • height
    resolution2K
    aspect_ratio1:1 (Square)

    A tiny utility node, and honestly a useful one if you've ever squinted at a Seedream node's width/height fields. Resolution Helper computes pixel dimensions from a resolution preset and an aspect ratio, then outputs them as two integers you can wire straight into any width/height input. It lives in the pack because its numbers match what the BytePlus image API accepts - the presets land near 1M, 4M, 9M, and 16M pixels, capped at the API's 16,777,216-pixel ceiling so you never feed the cloud a dimension it rejects.

    Pick resolution (1K/2K/3K/4K) and aspect_ratio (square, 4:3, 3:4, 16:9, 9:16, 3:2, 2:3, 21:9), and out come width and height as INT. The math picks the largest dimensions that fit the target pixel count at your aspect ratio, floors them at 64, and rounds to even numbers for codec compatibility - the fiddly bits you don't want to do by hand. The 2K default paired with 1:1 (Square) gives you 2048×2048, which is exactly what the Seedream 4 nodes default to.

    How to use it

    This is a wiring node, not a generation node. Connect its width/height outputs to the width/height inputs of a Seedream 4 Text-to-Image or Image-to-Image node, and changing one dropdown upstream reconfigures the whole graph. That's the whole trick: a single Resolution Helper can drive several nodes, so your workflow keeps one consistent output size instead of three stale copies of the same number.

    Install

    Same pack as everything else here:

    cd ComfyUI/custom_nodes
    git clone https://github.com/FloyoAI/ComfyUI-Seed-API
    cd ComfyUI-Seed-API
    pip install -r requirements.txt
    

    Restart ComfyUI. No API key needed for this one - it's pure math, no network calls, so it's the one node in this pack that works with an empty config.ini. Manager: search "ComfyUI Seed API Integration".

    Anything to watch?

    Not much - it's arithmetic. One honest caveat: the "K" naming is loose. 2K here means ~4 million pixels (2048×2048 in square), which is marketing-scale 2K, not DCI 2K (2048×1080) or 1440p. If you're targeting a specific display resolution, check the numbers it produces rather than trusting the label. Also note 4K square comes out at 4096×4096 only for 1:1; in wide ratios the API's pixel ceiling kicks in, so a 4K 21:9 preset won't hit literal 4K width - the cap is about total pixels, which is the right call for a paid API that bills on resolution class.

    CategorySeed/Utilities

    Inputs (2)

    NameTypeDefaultDescription
    resolutionCOMBO2K4 options: 1K, 2K, 3K, 4K
    aspect_ratioCOMBO1:1 (Square)8 options: 1:1 (Square), 4:3 (Standard), 3:4 (Portrait), 16:9 (Widescreen), 9:16 (Vertical), 3:2 (Photo), +2

    Outputs (2)

    NameTypeDescription
    widthINT
    heightINT