Mie Loop State Get Image ๐
Carrying the last frame forward in a ComfyUI loop
- loop_ctx
- fallback_image
- image
- found
The classic reason people build for-loops in ComfyUI at all is to chain image generations: take the last frame you made, feed it back in as the starting point for the next one, repeat until you've got a long video or an iteratively-refined image. The catch is that a loop's subgraph re-runs from scratch every lap, so "the last frame" doesn't just sit there waiting for you - you have to explicitly stash it somewhere and pull it back out. Get Image is the pull-it-back-out half of that.
Mechanism. Loop state in this pack rides on a custom type, MIE_LOOP_CTX, produced and updated by other nodes in the same Loop category as your loop runs. Get Image takes that context plus a key, and hands back whatever IMAGE was last stored under it - this is the node you'd put right after entering a new lap, feeding its output straight into an img2img sampler, a VAE encode, or an i2v conditioning input.
What sets this one apart from the other Get nodes in the family is the found output. Instead of silently falling back to a default value the way Get Bool or Get Int do, Get Image gives you an explicit BOOLEAN telling you whether anything was actually stored under that key. That matters because on the very first lap of a loop there usually isn't a "last frame" yet - you're starting from a fresh generation, not a fed-back one - and you need a clean way to branch on that instead of accidentally feeding a black or garbage image into your sampler.
Inputs and outputs.
loop_ctx(required) - must come from this pack's Loop nodes; the typed socket rejects anything else.key(defaultfeedback_image) - rename it if you're tracking more than one image through the loop (a "last frame" and a "reference frame," say).fallback_image(optional, IMAGE) - what gets returned if nothing's stored yet, so you can wire in your original seed image here instead of leaving the output empty on lap one.
Outputs: image (the retrieved IMAGE, or fallback_image if nothing was found) and found (BOOLEAN) - check that before you trust the image is real loop output rather than your fallback.
Installing. Manager: search ComfyUI_MieNodes and install. Manual: cd ComfyUI/custom_nodes && git clone https://github.com/MieMieeeee/ComfyUI-MieNodes, then restart. No model weights involved - this is pure state-passing, not generation.
Be aware: none of the Loop-category nodes, this one included, are documented in the pack's README - no node table, no example workflow. The read above comes from the node's schema and how a feedback loop of this shape has to be wired mechanically, not from author docs, so treat it as a working starting point rather than confirmed behavior.
Troubleshooting.
foundis alwaysfalse. Either you're on the loop's first lap (expected, usefallback_image), or the key your matching Set Image node writes to doesn't exactly match what you're reading here - these are free-text and case-sensitive, so a typo breaks the link silently.- Getting a black or blank image instead of the last frame. Almost certainly means you left
fallback_imageunconnected andfoundisfalse- check that output before assuming the image itself is broken. - Image sizes drift or mismatch across the loop. If your generation step changes resolution between passes (a resize node with a variable scale, for instance), the image you stash and re-retrieve can come back a different shape than what the rest of your loop expects downstream - pin the resolution explicitly if that matters.
loop_ctxtype error. You're wiring in something that isn't aMIE_LOOP_CTXfrom this pack's own Loop nodes - a generic dict, string, or another pack's context object won't be accepted.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| loop_ctx | MIE_LOOP_CTX | โ | |
| key | STRING | feedback_image | โ |
| fallback_imageopt | IMAGE | โ |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | โ |
| found | BOOLEAN | โ |