ImageStorageExportLoop
The node that feeds your keyframes back into the graph
- opt_pipeline
- IMAGE
- LOOP IDX (INT)
- IDX_IN_BATCH (INT)
This is the node that makes ComfyUI-Loopchain worth installing. The pack's whole trick - collect a bunch of frames, then run them back through the graph one slice at a time, with a loop index you can key off - lives in ImageStorageExportLoop. If you've ever wanted to grab a batch of saved frames and feed them through a ControlNet pass or a frame-interpolation model in sequence, this is the pull side of that pipe.
How it works
The storage is just a Python dictionary on the ComfyUI server (GLOBAL_IMAGE_STORAGE), keyed by whatever string you choose. The import side appends images to a key; this node reads the whole thing back and hands it to you in slices. Under the hood it concatenates every stored tensor into one batch, wraps it in a torch DataLoader with your batch_size, then returns batch[loop_idx]. So loop_idx doesn't index individual frames - it indexes batches. With 30 stored images and batch_size 10, you get three iterations, each handing you a 10-frame IMAGE tensor.
The frontend even asks the server how many batches exist (/loopchain/dataloader_length) so its Queue button knows exactly how many times to loop before it stops.
The inputs and outputs you'll set
key- the storage bucket name. It must match the key anImageStorageImportorFolderToImageStoragewrote to, exactly; the node asserts the key exists and throws if you typo it.batch_size- frames per iteration, default 1000. Bigger than your frame count is fine: you get one batch of everything.loop_idx- which batch to pull, default 0. Normally left alone; the Queue button walks it, and you can also drive it from an upstream loop node's index.
Outputs: IMAGE (the batch slice), LOOP IDX (INT), and IDX_IN_BATCH (INT) - that last one is loop_idx % batch_size, i.e. your position within the current slice. Wiring LOOP IDX into a conditioning or prompt is the classic way to vary something per iteration.
Where it fits
The README's example is the canonical shape: store a handful of head images, run this node in a loop, and each iteration takes the next slice through ControlNet + KSampler + VAE decode, with frame interpolation (ComfyUI-Frame-Interpolation, also by Fannovel16) smoothing the result. That's a keyframe-animation pipeline without ever loading a video model.
Gotchas worth knowing
Everything is in RAM and server-scoped - restart ComfyUI and the storage is gone, so the import must run in the same session. The Queue button auto-hides once the node has a wire into its opt_pipeline input, because then an upstream loop node drives it. And the whole pack is dormant (last commit late 2023) and experimental: the loop index has known quirks and the frontend can glitch on long runs. Install it for the idea - reusable keyframe loops - and expect to babysit it. There are no model files or pip dependencies; you get it from ComfyUI Manager (search "ComfyUI-Loopchain") or by cloning the repo into custom_nodes.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| key | STRING | — | |
| batch_size | INT | 1000 | — |
| loop_idx | INT | 0 | — |
| opt_pipelineopt | LOOPCHAIN_PIPELINE | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |
| LOOP IDX (INT) | INT | — |
| IDX_IN_BATCH (INT) | INT | — |