Mie Loop Finalize Images ๐
Pull the collected image batch out of the loop
- loop_ctx
- images
- merged_path
The payoff node. After a loop has run and MieLoopCollectImage has gathered an image every pass, MieLoopFinalizeImages emits the whole set as one IMAGE batch - the thing you actually wire into a preview, a save node, or a video combiner.
Part of ComfyUI-MieNodes (ComfyUI_MieNodes), MieMieeeee's utility pack, under the ๐ Loop submenu.
How it works
Finalize is the counterpart to Collect. All through the loop, images accumulate inside the loop_ctx. Finalize waits for the loop to actually be over - which it knows because you wire MieLoopEnd's done signal into it - and only then reads the accumulator and hands over the full batch. That done gate is what stops it from firing mid-loop with a half-filled set.
The inputs and outputs that matter
loop_ctx(MIE_LOOP_CTX) - the loop context carrying the collected images.done(BOOLEAN) - the completion signal from MieLoopEnd. This is the trigger; without it, Finalize has nothing telling it the loop is finished.avoid_oom(BOOLEAN, default true) - leave this on. On a big collection, materializing every image into memory at once to build the batch can blow up VRAM/RAM. Withavoid_oomon, Finalize is careful about how it assembles the set - especially valuable when you collected withoffload_to_disk.
Outputs:
images(IMAGE) - the full batch, ready to preview, save, or feed onward.merged_path(STRING) - the on-disk location of the assembled/offloaded images. Handy when the batch is large enough that you'd rather point a downstream step at files than push the whole thing through the graph.
Installing it
ComfyUI Manager โ search ComfyUI-MieNodes โ install โ restart. Or:
cd ComfyUI/custom_nodes
git clone https://github.com/MieMieeeee/ComfyUI-MieNodes
then restart. No model downloads or heavy dependencies. Under ๐ MieNodes โ ๐ Loop.
Common issues
It outputs nothing / an empty batch. Nine times out of ten the done input isn't wired. Finalize only fires when MieLoopEnd's done reaches it. The other cause is a broken loop_ctx chain - if Collect's context didn't make it to Finalize, there's nothing to hand over.
Out-of-memory at finalize. Keep avoid_oom on (it's the default). If you're collecting a lot of high-res images, also collect with MieLoopCollectImage's offload_to_disk enabled so they're not all in memory to begin with.
The batch mixes resolutions. If passes produced different sizes, the batch may be awkward or refuse to stack cleanly. Resize to a common resolution before collecting, not here.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| loop_ctx | MIE_LOOP_CTX | โ | |
| done | BOOLEAN | โ | |
| avoid_oomopt | BOOLEAN | true | Avoid OOM: stream phase 2 through a numpy.memmap so peak RAM is ~1 chunk (not final+chunk). DEFAULT ON -- leave it on for any long-running loop. Turning it off reverts to a pre-allocate path that needs ~final+chunk contiguous RAM; on a typical SCAIL-2 30-batch run that exceeds 24 GB and will OOM-crash the merge, losing the whole run. |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| images | IMAGE | โ |
| merged_path | STRING | โ |