Nodes/ComfyUI-FairLab/Range String
ComfyUI Node

Range String

Batch naming without the spreadsheet

By yanhuifair·Created 2 years ago·Updated 3 months ago· 2
Range String
    • strings
    start0
    stop0
    step1

    The FairLab Range String node generates a list of stringified numbers - 0, 1, 2, 3… - from a numeric range. It's the kind of node you skip for two weeks and then realize you've been hand-typing a filename list that this thing produces in one step.

    The README frames it with the example that actually matters: frame_001..frame_100. When you're working with video, frame-by-frame processing, or any batch of outputs that needs indexed names, you need a list of numbers to feed your naming logic. This is that list, as strings, ready to concatenate.

    How it works

    It runs Python's range(start, stop, step) and stringifies every value. The output is a list of strings - the node declares OUTPUT_IS_LIST, so unlike the pack's other string nodes the strings socket carries a batch, and nodes downstream that accept lists can consume it directly.

    The three inputs, all integers:

    • start - where the range begins (inclusive).
    • stop - where it ends (exclusive - this is the gotcha).
    • step - how much to jump each iteration.

    The gotcha: stop is exclusive

    Because it's Python's range under the hood, the range stops before stop. start=0, stop=10 produces 0..9, not 0..10. If you want 100 frames named frame_001..frame_100, set stop=101 (or start=1, stop=101) and remember it. This is the single most common surprise with the node, and it's silent - you just get one fewer value than you expected.

    Two more things worth knowing:

    • No zero-padding. 1 comes out as "1", not "001". The README's frame_001 example is aspirational unless you pad yourself - build a "{:03d}"-style format with another string node, or accept the ugly-but-fine frame_1.
    • Negative steps work. start=10, stop=0, step=-1 counts down. Same exclusive-stop rule applies.

    What you'd actually do with it

    • Feed indexed prefixes into a filename builder for Save Image To Directory or Save Image To Folder.
    • Drive batch iteration where each run needs a distinct suffix.
    • Generate a numbered sequence to join with String Append.

    It's a pure, deterministic list generator - no randomness, no model, no files touched. If you need random numbers or frame sampling from an actual video, that's Video To Image or a random seed node, not this.

    Installing it

    Same pack, same install - one clone gets all 58 nodes:

    cd ComfyUI/custom_nodes
    git clone https://github.com/yanhuifair/ComfyUI-FairLab.git
    cd ComfyUI-FairLab
    pip install -r requirements.txt
    

    Then restart, or search "ComfyUI-FairLab" in ComfyUI Manager. No dependencies of its own. If the node won't accept a wire from a FLOAT source, remember the inputs are INT - feed it the pack's Int node or a primitive.

    CategoryFair/string

    Inputs (3)

    NameTypeDefaultDescription
    startINT0
    stopINT0
    stepINT1

    Outputs (1)

    NameTypeDescription
    stringsSTRING