Batch Image Loop Close🐰
Collect every processed region back into a list
- flow_control
- current_image
- current_mask
- result_images
- result_masks
This is the closing bracket for CyberEve_BatchImageLoopOpen. Everything you did to current_image/current_mask between Open and Close - sampling, inpainting, color work, whatever - gets collected here pass by pass, and once the loop has run through every region, it releases two lists: every processed image and every processed mask, in the same order they came in. Without this node, the loop has no way to know when to stop or where to send the results.
How it works
On each iteration, Batch Image Loop Close takes whatever current_image/current_mask look like after your processing chain has touched them, checks the flow_control signal against max_iterations, and either loops back for the next region or, once the last region's been processed, finalizes and hands off result_images/result_masks downstream. That's the normal, expected use: CyberEve_MaskSegmentation → CyberEve_BatchImageLoopOpen → your processing → CyberEve_BatchImageLoopClose → CyberEve_MaskMerge.
There's a second mode worth knowing about, added in the pack's January 2025 update: pass_back. Turn it on and instead of always feeding the next region's original segment into the loop start, it passes the image you just finished processing back to the beginning of the loop. That's a genuine behavior change, not a tweak - it turns the batch loop from "process N independent regions in parallel passes" into something closer to a feedback chain, where later regions can build on whatever happened to earlier ones. Most batch use cases don't need this; leave it off unless you specifically want that carry-over effect.
Inputs and outputs
Required:
flow_control- fromCyberEve_BatchImageLoopOpen'sFLOW_CONTROLoutput. This is the wire that actually drives the loop.current_image/current_mask- the processed region for this pass, coming out of whatever chain you built between Open and Close.max_iterations- passed straight through from Open; tells this node when it's seen the last region.
Optional:
pass_back(BOOLEAN, defaultfalse) - enables the feedback behavior described above.
Outputs:
result_images/result_masks- the full collected lists, ready to feed intoCyberEve_MaskMerge'sprocessed_imagesandmasksinputs.
Installing it
Part of the ComfyUI-Loop-image pack - installing the pack gets you this node and the other six alongside it. Via ComfyUI Manager: search "ComfyUI-Loop-image", install, restart. Manual:
cd ComfyUI/custom_nodes
git clone https://github.com/WainWong/ComfyUI-Loop-image
No models to download, nothing GPU-specific about this node - it's control flow and list bookkeeping. Look for it under CyberEveLoop🐰.
Common issues
Nothing happens after the loop finishes. Make sure result_images/result_masks actually connect to something - usually CyberEve_MaskMerge. A Close node with dangling outputs will finish the loop fine internally but leave you with nothing downstream to look at.
Results look wrong or misaligned per region. Since result_images/result_masks come out in the same order Mask Segmentation produced them (left-to-right, top-to-bottom), a mismatch here almost always traces back to whether current_image/current_mask actually correspond to the region you think they do on that pass - double-check what's feeding into current_image inside your loop body, especially if you've got branching via CyberEve_LoopIndexSwitch in there.
Turned on pass_back and results changed unexpectedly. That's expected - it changes what feeds the next iteration. If your regions started looking like they're drifting from region to region instead of staying independent, pass_back is almost certainly why. Turn it off if you wanted each region processed in isolation.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| flow_control | FLOW_CONTROL | — | |
| current_image | IMAGE | — | |
| current_mask | MASK | — | |
| max_iterations | INT | — | |
| pass_backopt | BOOLEAN | false | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| result_images | IMAGE | — |
| result_masks | MASK | — |