Nodes/ComfyUI-hybs-nodes/Random Resolution Selector
ComfyUI Node

Random Resolution Selector

Randomize image size by seed — deterministically

By hybskgks28275·Created about a year ago·Updated 2 months ago· 3
Random Resolution Selector
    • width
    • height
    seed0

    Resolution is usually the one thing you don't want to randomize - but for testing and grids, having size vary across a batch is exactly the point. HYBS_RandomResolutionSelector picks a resolution from the pack's config file based on a seed: index = seed % number_of_combos. Same seed, same config, same size. That determinism is the whole trick - you get "random" sizes across seeds without losing reproducibility, which is why this node pairs naturally with the pack's Seed List Generator for resolution-sweep batches.

    Where the plain Resolution Selector is a manual dropdown, this is the automated cousin. It's for workflows that iterate over a batch and should visit different sizes: composition testing across aspect ratios, training-data-ish sampling, or stress-testing "does my model still hold up at portrait vs. landscape."

    How it works

    The mechanism is tiny and it's right in the tooltips:

    • seed (INT, default 0, non-negative) - fed through seed % len(combos) to index the list of combos

    Outputs are the usual pair:

    • width (INT)
    • height (INT)

    Both the Random and plain selectors read the same config/resolution_combos.json (with the same built-in default list if the file is missing), but the Random one has two behaviors that matter:

    1. It reloads the JSON on every execution. Edit the file mid-session and the next run picks up the change - no restart.
    2. Its execution fingerprint includes the config file's modification time. So editing resolution_combos.json forces the node to re-run even if the seed hasn't changed, instead of ComfyUI treating it as cached.

    The other consequence of seed % len(combos): adding or removing combos reshuffles which seed maps to which resolution. If you've tuned a specific seed to a specific size, don't edit the config underneath it.

    Installation

    Standard pack install:

    cd path/to/ComfyUI/custom_nodes
    git clone https://github.com/hybskgks28275/ComfyUI-hybs-nodes.git
    pip install -r ComfyUI-hybs-nodes/requirements.txt
    

    Or "ComfyUI-hybs-nodes" via ComfyUI Manager, then restart. No models, no extra deps.

    One honest limitation before you build a whole thing on it: because it's modular-arithmetic "random," the sizes are uniformly picked from the config but in a fully predictable order as seeds climb. That's a feature for reproducibility and a mild letdown if you expected true shuffling - consecutive seeds walk the list in order, they don't hop. For a batch where each image gets a different seed, you'll still see a spread of sizes, which is the point. And as with any size variation, remember the KB's warning: don't push far past the model's native training resolution, or you'll get tiling and duplicated anatomy instead of variety.

    CategoryHYBS/ResolutionSelector

    Inputs (1)

    NameTypeDefaultDescription
    seedINT0Deterministic pick: index = seed % len(combos).

    Outputs (2)

    NameTypeDescription
    widthINTWidth of the selected resolution.
    heightINTHeight of the selected resolution.