Single Image Loop Close🐰
Get your final result out of an iterative loop
- flow_control
- current_image
- current_mask
- final_image
- final_mask
This is the other half of CyberEve_SingleImageLoopOpen. Every pass of your progressive-processing loop routes back through here - it checks whether you've hit max_iterations yet, and if not, feeds the just-processed image (and mask, if you're using one) back to the start for another pass. Once the last iteration finishes, it stops looping and hands you the final result. Without it, Open has nothing to close the circuit with, and the loop never actually loops.
How it works
The relationship between the pair is genuinely simple once you see it: Open hands out current_image for the pass, your processing chain does whatever it does to it, and that processed result flows into Close's current_image input. Close compares the iteration count against max_iterations - if there's more to do, it sends the processed image back to Open as the next pass's starting point; if not, it stops and outputs final_image. That feedback is the entire mechanism behind "run this chain five times, each time building on the last" - there's no actual Python for-loop under the hood, just this back-and-forth between two nodes.
Inputs and outputs
Required:
flow_control- fromCyberEve_SingleImageLoopOpen'sFLOW_CONTROLoutput. This is what actually drives the loop; without it wired, nothing loops.current_image- the processed image for this pass, coming out of whatever chain you built between Open and Close.max_iterations- passed straight through from Open, telling Close when to stop.
Optional:
current_mask- the processed mask for this pass, if you started the loop with one on Open. Since it's optional, you can run the whole loop mask-free if your processing doesn't need one.
Outputs:
final_image- the result after the last iteration, ready to feed into a preview, save node, or whatever comes next.final_mask- the mask after the last iteration, if you supplied one to begin with.
Installing it
Part of the ComfyUI-Loop-image pack - install once for all seven nodes. Through ComfyUI Manager: search "ComfyUI-Loop-image", install, restart. Manual clone:
cd ComfyUI/custom_nodes
git clone https://github.com/WainWong/ComfyUI-Loop-image
No models to fetch, nothing GPU-bound about this node specifically - it's loop bookkeeping. It's filed under CyberEveLoop🐰 in the node menu.
Common issues
Nothing downstream reacts once the loop finishes. Make sure something's actually wired to final_image (and final_mask, if you're using it) - a Close node with dangling outputs completes the loop internally but leaves you with no visible result. This is the single most common "why did nothing happen" report for loop constructs in general: the loop itself worked fine, there just wasn't anywhere for the finished value to go.
Started the loop with a mask, but final_mask is empty downstream. current_mask on this node is optional - if you forget to wire the processed mask back in from your loop body (even though you fed one into Open), you'll get no mask out the other end, and anything downstream expecting one will break. If you're using a mask at all, keep it flowing through every stage: Open → your chain → Close, same as the image.
The image looks unchanged after several iterations. Almost always the same wiring mistake as on the Open side - verify that current_image feeding into this node is the output of your processing chain, not a stray reconnection back to the original input image. If Close keeps receiving the same starting image every pass, the loop will run the requested number of times but never actually accumulate anything.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| flow_control | FLOW_CONTROL | — | |
| current_image | IMAGE | — | |
| max_iterations | INT | — | |
| current_maskopt | MASK | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| final_image | IMAGE | — |
| final_mask | MASK | — |