Nodes/comfy-easy-grids/Create Image Grid
ComfyUI Node

Create Image Grid

ComfyUI's hidden for loop

By shockz0rz·Created 3 years ago·Updated 2 years ago· 28
Create Image Grid
    • x_index
    • y_index
    • x_size
    • y_size
    x_count1
    y_count1

    If you came from Automatic1111, you remember X/Y/Z Plot - the button that ran the same prompt across a grid of settings and stitched the results into one comparison sheet. ComfyUI never shipped an equivalent, and the gap is exactly why this node exists. Its real name is "Create Image Grid," but read the author's own pitch and you'll see what it actually is: a general-purpose for loop wearing a grid costume.

    What it does

    You feed it two numbers, x_count and y_count. Every time the graph executes, it hands back four integers: x_index, y_index, x_size, and y_size. x_index counts from 1 up to x_count, then resets and y_index increments. Repeat until you've covered every cell of the grid, then the whole thing wraps. That's the entire mechanism - a stateful counter, nothing cleverer.

    The clever part is what you wire those indexes into. Attach x_index to the seed on a KSampler and you get a different seed per cell. Feed it into the index input of any of this pack's list nodes and each cell pulls a different LoRA, float, or prompt fragment. It's the engine that makes "change one variable at a time, fixed seed, compare" actually practical in a graph editor.

    The inputs and outputs that matter

    Only two inputs, both required:

    • x_count - how many columns (INT, min 1)
    • y_count - how many rows (INT, min 1)

    And four outputs: x_index, y_index, x_size, y_size. Wire x_size and y_size straight into the matching inputs on the pack's Save Image Grid node - they're meant to travel together.

    The gotcha everyone hits

    Indexes are 1-based, not 0-based. The pack's own list nodes expect this, but anything else that indexes into an array (a lot of ComfyUI list utilities) starts at 0. If your first grid cell pulls the wrong list entry, this is why.

    Also: because the counter lives on the node instance, changing x_count or y_count mid-flight resets it to the start. That's usually what you want, but it surprises people mid-batch.

    Using it

    The node ships with a JavaScript extension that adds three buttons. Queue Full Grid queues x_count × y_count prompts in one click - this is the intended workflow. Reset Grid Loop and Reset All Loop Nodes call the pack's /easygrids/reset API endpoint to zero the counters when a run goes sideways. Mashing the regular Queue Prompt button also works - each press advances the loop by one - but it's slower and easy to lose count of.

    Installing it

    It's part of comfy-easy-grids, so there's only one install. Either use ComfyUI Manager (search "comfy-easy-grids") or clone it by hand:

    cd ComfyUI/custom_nodes
    git clone https://github.com/shockz0rz/comfy-easy-grids
    

    Then restart ComfyUI. There's no requirements.txt and no model files - this pack runs on what ComfyUI already ships. All its nodes appear under the "EasyGrids" section of the Add Node menu.

    Troubleshooting

    The most common failure is a workflow that references the node but the graph never runs - usually because a stale copy of the workflow expects a different pack. Reinstall via Manager, and if a node still shows as missing, check that custom_nodes/comfy-easy-grids actually exists. Beyond that, this node is one of the more reliable bits of the pack; it's basically a counter with a button.

    CategoryEasyGrids

    Inputs (2)

    NameTypeDefaultDescription
    x_countINT1
    y_countINT1

    Outputs (4)

    NameTypeDescription
    x_indexINT
    y_indexINT
    x_sizeINT
    y_sizeINT