Nodes/ComfyUI_SamplingUtils/SamplingParameters
ComfyUI Node

SamplingParameters

One node that answers 'what size are my tiles?'

By silveroxides·Created 11 months ago·Updated 3 months ago· 20
SamplingParameters
    • width
    • height
    • batch_size
    • upscaled_width
    • upscaled_height
    • steps
    • cfg
    • seed
    • tile_width
    • tile_height
    • tile_padding
    width1024
    height1024
    batch_size1
    scale_by1.00
    multiple16
    steps26
    cfg3.50
    seed

    Most ComfyUI workflows define width, height, steps, CFG, and seed in five different places, and then you want to upscale the result and suddenly you're computing tile sizes by hand in your head. SamplingParameters is the one-stop node from this pack that makes the base settings a single source of truth and, more usefully, computes the upscaled dimensions and tiled-sampling dimensions for you.

    What it gives you

    Eight inputs, eleven outputs. The first six inputs are the boring-but-essential set:

    • width / height (default 1024, snapped to multiple)
    • batch_size
    • steps (default 26) and cfg (default 3.5)
    • seed - an INT with a control_after_generate dropdown, same widget that bites everyone once (set "widget control mode" to Before or you'll "lose" seeds)

    The interesting pair is scale_by - "How much to upscale initial resolution by for the upscaled one" - and multiple - "Nearest multiple of the result to set the upscaled resolution to." From those, the node computes five derived outputs:

    • upscaled_width / upscaled_height - base resolution × scale_by, rounded to the nearest multiple
    • tile_width / tile_height / tile_padding - tile sizes for a tiled second pass

    How the tile math works

    Straight from the source: if scale_by > 2, tiles are computed as (upscaled − base/scale_by) / scale_by; otherwise tiles are half the upscaled size. tile_padding is max(base dimension) − max(tile dimension). The idea is the standard two-pass upscaling pattern - generate at base res, then tile the upscaled canvas so the second pass runs within VRAM instead of blowing past it (the tiled-diffusion approach the KB's upscaling doc recommends for large outputs on limited cards). Feed the tile outputs into a tile-based upscaler or KSampler (advanced) tiling workflow and you never hand-compute a tile size again.

    The trap to watch

    The derived numbers are only as good as scale_by and multiple. If you set multiple to 128 and a base dimension of 1000, everything rounds to the nearest 128 - which is usually what you want for diffusion (native multiples) but can surprise you when the numbers don't divide evenly. Also remember the seed's control_after_generate trap above; the seed you see is the one used next run unless you set it to Fixed.

    Install

    ComfyUI Manager → search ComfyUI_SamplingUtils, or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/silveroxides/ComfyUI_SamplingUtils
    

    then restart. Real deps from requirements.txt: kornia, scipy, pilgram, opencv-python, unifiedefficientloader>=0.5.0. Pack note: the README declares the pack DEPRECATED in favor of ComfyUI-UtilsCollection - this node is self-contained and stable, but if you're starting fresh, check whether the successor has an equivalent before wiring it deep into a saved workflow.

    Categoryadvanced

    Inputs (8)

    NameTypeDefaultDescription
    widthINT102416–16384
    heightINT102416–16384
    batch_sizeINT11–4096
    scale_byFLOAT1.000–10How much to upscale initial resolution by for the upscaled one.
    multipleINT164–128Nearest multiple of the result to set the upscaled resolution to.
    stepsINT261–10000How many steps to run the sampling for.
    cfgFLOAT3.50-100–100The amount of influence your prompot will have on the final image.
    seedINT-9223372036854776000–9223372036854776000

    Outputs (11)

    NameTypeDescription
    widthINT
    heightINT
    batch_sizeINT
    upscaled_widthINT
    upscaled_heightINT
    stepsINT
    cfgFLOAT
    seedINT
    tile_widthINT
    tile_heightINT
    tile_paddingINT