Batch Image Loop Open🐰
Process each mask region one at a time
- segmented_images
- segmented_masks
- FLOW_CONTROL
- current_image
- current_mask
- max_iterations
- iteration_count
ComfyUI graphs run once, straight through, no going back - there's no native "for each region, do X" primitive. Batch Image Loop Open is one half of how ComfyUI-Loop-image fakes it. Pair it with its sibling, CyberEve_BatchImageLoopClose, and it wraps whatever's between them so it runs once per segmented region instead of once total. This is the node you reach for when you've got a mask covering several separate areas of an image and you want to run a different sampler pass, different prompt, or different strength on each one, without hand-duplicating your whole processing chain three or five or ten times.
Where it sits in the pipeline
It's the second stage of the batch pipeline, always fed by CyberEve_MaskSegmentation. Segmentation splits one multi-region mask into a list of per-region image/mask pairs; this node takes that list and, on each pass, hands out exactly one pair for you to process. What you do with current_image/current_mask in between Open and Close is entirely up to you - a KSampler, an inpaint chain, a color-grade node, whatever. The loop mechanics don't care what's inside.
Inputs and outputs
Both required inputs come straight from Mask Segmentation:
segmented_images- the per-region image list.segmented_masks- the per-region mask list.
Outputs:
FLOW_CONTROL- wire this toCyberEve_BatchImageLoopClose'sflow_controlinput. This is the signal that actually drives the loop; without it connected, nothing loops.current_image/current_mask- the region being processed this pass. These are what you plug into your actual processing nodes.max_iterations- the total number of regions, computed automatically from how many segments came out of Mask Segmentation. You don't set this by hand; it just threads through to Close so the loop knows when to stop.iteration_count- which pass you're on, starting at 0. Useful if you want per-region behavior beyond just a different crop - wire it intoCyberEve_LoopIndexSwitchto pick a different prompt, LoRA, or strength for region 0 versus region 1.
One quality-of-life detail from the pack's January 2025 update: if you feed in a single whole image alongside a multi-region mask (instead of a matching per-region image list), this node auto-expands the image to match the mask batch size rather than erroring out. Worth knowing if you're skipping Mask Segmentation and wiring things up more manually.
Installing it
Install the pack once to get every node in it, this one included. In ComfyUI Manager, search "ComfyUI-Loop-image" and install. Or manually:
cd ComfyUI/custom_nodes
git clone https://github.com/WainWong/ComfyUI-Loop-image
Restart ComfyUI. No models, no extra weights - it's pure graph control flow, so there's nothing to download and no GPU cost attributable to the node itself. You'll find it under the CyberEveLoop🐰 category.
Common issues
The loop doesn't seem to loop - it just runs once. Check that FLOW_CONTROL actually reaches CyberEve_BatchImageLoopClose. That wire is what re-triggers the subgraph between Open and Close; if it's disconnected or routed somewhere else, everything downstream just runs a single pass on the first region and stops.
Mismatched region and image counts. If you're not routing through Mask Segmentation and instead wiring segmented_images/segmented_masks by hand, make sure the two lists are actually the same length - a mismatch is the most common source of a loop that either crashes partway or silently processes the wrong region against the wrong mask.
Don't mix this with the single-image nodes. CyberEve_BatchImageLoopOpen is meant to close with CyberEve_BatchImageLoopClose, not CyberEve_SingleImageLoopClose - the two Close nodes expect different payloads (batch mode requires a mask every pass; single mode treats it as optional), so crossing them won't give you the pipeline you're after.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| segmented_images | IMAGE | — | |
| segmented_masks | MASK | — |
Outputs (5)
| Name | Type | Description |
|---|---|---|
| FLOW_CONTROL | FLOW_CONTROL | — |
| current_image | IMAGE | — |
| current_mask | MASK | — |
| max_iterations | INT | — |
| iteration_count | INT | — |