Image Accum State Unpack
The node that reads the loop's memory
- loop_state
- remaining
- accumulation
- previous_value
- accumulated_count
- count
- open_node_id
- total_frames
_ImageAccumStatePack bundles the whole loop state into one dict so it can ride a single wire. _ImageAccumStateUnpack is the other end of that wire: it takes the dict apart and hands each piece back as a proper typed output. It's the simplest of the dev-only helper nodes in kijai's NativeLooping pack - one input, seven outputs, no settings - and it sits at the start of every TensorLoopClose expansion, because the loop has to know where it is before it can decide where to go.
What it does
Give it a loop_state dict and it returns everything the loop machinery needs:
- remaining (INT) - iterations left in countdown mode.
- accumulation (ACCUMULATION) - the list of everything collected so far, ready to be appended to.
- previous_value (any) - the last iteration's output, which becomes the next iteration's input.
- accumulated_count (INT) - how many frames/items are in the accumulation right now (adjusted for fade overlap that will consume seam frames).
- count (INT) - the original iteration count (0 in total-frames mode).
- open_node_id (any) - which TensorLoopOpen started this loop; used for progress bars and for finding the body's bounds.
- total_frames (INT) - the frame target, 0 when not in total-frames mode.
The classic unpack/repack cycle: TensorLoopClose unpacks the state, subtracts one from remaining via an _IntOperations node, appends the new output via _AccumulateNode, and hands the results to _ImageAccumStatePack again - which decides whether the loop keeps going. Unpack is the "read," Pack is the "write."
Why it exists
Partly type hygiene, partly keeping the wire count down. The state rides through the while-loop primitives as a single opaque value; unpack is what gives it structure back at the edges, where the loop needs to inspect it. If you're building your own loop from these primitives, the pattern to copy is: unpack → read counters → do work → repack → recurse. And if you're ever staring at an expanded workflow full of _-prefixed nodes wondering what's connected to what, Unpack is the map - every line of loop logic starts here.
Install
Same as the rest of the pack:
cd ComfyUI/custom_nodes
git clone https://github.com/kijai/ComfyUI-NativeLooping_testing
Restart ComfyUI, or search "NativeLooping" in Manager. Dev-only, hidden from the menu, no extra dependencies.
One heads-up that applies to all the internal nodes here: this is a _testing repo from kijai - a candidate for native ComfyUI loop nodes, per the README - so the state-dict layout is not a stable contract. Don't hand-wire workflows against these internals expecting them to survive the next commit. If you just use TensorLoopOpen/TensorLoopClose, you'll never have to.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| loop_state | * | — |
Outputs (7)
| Name | Type | Description |
|---|---|---|
| remaining | INT | — |
| accumulation | ACCUMULATION | — |
| previous_value | * | — |
| accumulated_count | INT | — |
| count | INT | — |
| open_node_id | * | — |
| total_frames | INT | — |