Nodes/XB_ToolBox/XB-BOX - Image Params Master Mini
ComfyUI Node

XB-BOX - Image Params Master Mini

One place to set the canvas — and it snaps to the grid for you

By wjluoxiao·Created 6 months ago·Updated 5 days ago· 351
XB-BOX - Image Params Master Mini
    • Image Width
    • Image Height
    • Batch Size
    • Scale Size
    ◄aspect_ratioFree►
    ◄width1024►
    ◄height1024►
    ◄batch_size1►

    Most ComfyUI graphs end up with the same number typed into four different boxes. You set 1024×1024 on the empty latent, then again on the upscale, then again on whatever video or refiner node downstream, and the moment you want 16:9 you get to redo all of them and hope you didn't leave one at 1024. XB_ImageParamsMasterMini is the smallest possible fix for that: four widgets, four integer outputs, one canvas definition you wire everywhere.

    It's the "mini" member of the XB_ToolBox pack's parameter-master family - the full XB_ImageParamsMaster adds strength controls, this one is just the geometry. If you've used rgthree's seed node or any primitive/context node, you already know the pattern: a value lives in one node and travels by wire instead of being retyped. Duplicated width/height is the most common instance of that pattern in the whole graph.

    What it actually does

    Two things, and the second one is the reason to install it.

    First, pass-through: width, height and batch_size come out as Image Width, Image Height and Batch Size, all plain INT. Wire them into an empty-latent node (or the pack's own latent-building nodes) and the batch into anything that takes a count. That part is trivial and it's most of the value - change the source once and every consumer follows.

    Second, the aspect-ratio lock. Set aspect_ratio to anything but Free and the node recomputes the other side from the larger one, rounded onto a 16-pixel grid - round(), not integer division, deliberately, so repeated edits don't accumulate drift. Free is a straight pass-through with no snapping to the ratio. 1:1, 16:9, 9:16, 4:3, 3:4 and 21:9 are the options.

    The fourth output, Scale Size, is the long edge in pixels - max(width, height) after snapping. It reads like a multiplier and it isn't one; it exists so you can feed a single "size" number into a scale/size input on another node. The pack's larger sibling variant calls that field 缩放尺寸 for the same reason.

    The inputs you touch

    • aspect_ratio - leave it on Free and type both dimensions yourself; pick a fixed ratio when you want the lock.
    • width / height - 64 to 8192, step 16. Getting the bigger one right is enough when a ratio is locked.
    • batch_size - 1 to 1000, just forwarded.

    Outputs: Image Width and Image Height into your latent node, Batch Size into whatever counts, Scale Size into a single-number size input.

    One grid trap worth knowing

    The step here is hard-locked to 16. That's fine for SDXL, SD3, Flux, Z-Image and anything else on an 8- or 16-divisible grid. It is not the right tool if you're on Qwen-Image or Hunyuan 2.1, whose official latents want 32-divisible sizes - a multiple of 16 isn't always a multiple of 32. The pack's XB_ImagePromptPresetPro node carries a per-model table (8/16/32 depending on the latent type) and is the one to use there. The snapping is resolution hygiene, not aesthetics: it stops you handing a 1024-trained model a stretched canvas and getting duplicated anatomy.

    Install

    ComfyUI Manager → search XB_ToolBox → install → restart. Or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/WJLUOXIAO/XB_ToolBox
    

    This node itself is pure Python arithmetic - no models, no extras. But read the README's "NO extra pip dependencies required! Plug and play" line skeptically: the pack's requirements.txt on disk pulls opencv-python, easyocr, onnxruntime, pythonnet, av and a full transformers/diffusers/modelscope stack for its audio and comic tools. Manager will run that list, which is a lot of kilobytes for a node that adds two integers - a manual clone is the lighter path.

    Common issues

    Nothing visibly changes when you pick a ratio. The widget-to-widget updating is JavaScript (the pack ships a js/ directory and hooks these nodes). If the frontend didn't load, the Python still returns snapped values - trust the console log and the actual image size, not the boxes on screen. Do a hard refresh after installing.

    The ratio is eating the wrong side. It derives from the larger input dimension, always. If you care about a specific short side, use Free and type both numbers.

    Scale Size isn't what you expected. It's pixels on the long edge, not a 1.5× style factor. Wire it into a size input, or ignore it - the other three outputs are the node.

    CategoryXB_ToolBox/Image_Params

    Inputs (4)

    NameTypeDefaultDescription
    aspect_ratioCOMBOFree7 options: Free, 1:1, 16:9, 9:16, 4:3, 3:4, +1
    widthINT102464–8192—
    heightINT102464–8192—
    batch_sizeINT11–1000—

    Outputs (4)

    NameTypeDescription
    Image WidthINT—
    Image HeightINT—
    Batch SizeINT—
    Scale SizeINT—