Nodes/ComfyUI_MieNodes/Mie Loop Cleanup Images ๐Ÿ‘
ComfyUI Node

Mie Loop Cleanup Images ๐Ÿ‘

Clear intermediate images so a long loop doesn't fill your disk

By MieMieeeeeยทCreated 2 years agoยทUpdated 28 days agoยท 225
Mie Loop Cleanup Images ๐Ÿ‘
  • loop_ctx
  • loop_ctx
  • cleaned

Run a loop a few hundred times and it doesn't just cost compute - it leaves a trail. Every pass that writes a temp image, a preview, or a staged file adds to a pile that nothing clears. MieLoopCleanupImages is the housekeeping node that deletes those intermediate image files during the loop, so a long iterative job doesn't quietly fill your disk.

It's part of ComfyUI-MieNodes (ComfyUI_MieNodes), MieMieeeee's utility pack, under ๐Ÿ‘ Loop.

Why you'd reach for it

MieNodes' loop system exists so you can run one sub-graph over a whole set - every image in a folder, every frame, every item in a batch. The dark side of that is scale: an operation that harmlessly writes one scratch PNG is fine once and a disaster across 800 iterations. On a cloud runner with a modest disk, or a local box you'd rather not babysit, filling storage mid-run is exactly the failure that kills an overnight job. This node keeps the working set small by clearing the image leftovers as the loop goes, instead of leaving one giant sweep for the end (that may never come if you run out of space first).

Think of it as the images-specific member of a cleanup quartet - there are siblings for audio, text, and JSON. You drop in whichever matches the kind of scratch files your loop produces.

How it works

It's wired into the loop by the shared MIE_LOOP_CTX context that threads through every node in the subsystem. It takes the context in, does its cleanup of the loop's intermediate image files, and passes the context back out so the loop continues. The extra output is a simple cleaned boolean reporting whether a cleanup actually happened this pass - handy for logging or for branching if you want to react to it.

The inputs and outputs that matter

  • loop_ctx (MIE_LOOP_CTX, required) - the loop context; this is what tells the node which loop's intermediates to clear. Thread it in and back out.
  • loop_ctx (output) - pass onward so the loop keeps running.
  • cleaned (BOOLEAN, output) - did it remove anything this pass?

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 download. Nodes appear under ๐Ÿ‘ MieNodes.

Common issues & troubleshooting

It deletes files. Be sure they're intermediates. Cleanup is destructive and there's no undo. It's meant to clear the loop's scratch images, not your final outputs - make sure your keepers are written somewhere the loop doesn't treat as disposable before you rely on this in an unattended run.

cleaned came back false. That just means there was nothing to remove on that pass - no intermediate images had been written yet, or a prior cleanup already got them. It's not an error.

Only works inside the loop subsystem. Like the rest of these, it depends on the MIE_LOOP_CTX flowing from MieLoopBodyIn through to MieLoopBodyOut. It's not a general-purpose "delete my images" node - it's scoped to what the loop generated.

Ordering matters. Cleanup should run after you've done whatever you need with an iteration's images and before the disk pressure builds. Since ComfyUI schedules by dependency, use the loop's ordering handles (the body-in anchor) so cleanup fires at the right point in each pass, not early.

Category๐Ÿ‘ MieNodes/๐Ÿ‘ Loop

Inputs (1)

NameTypeDefaultDescription
loop_ctxMIE_LOOP_CTXโ€”

Outputs (2)

NameTypeDescription
loop_ctxMIE_LOOP_CTXโ€”
cleanedBOOLEANโ€”