Nodes/ComfyUI-Stacker/StackPopImage
ComfyUI Node

StackPopImage

Pull images back out of a stack — and decide whether to consume or just peek

By concarne000·Created about a year ago·Updated about a year ago· 10
StackPopImage
  • fallback_item
  • override_item
  • IMAGE
keydefault
fallback_enabledfalse
override_enabledfalse
stackmodeNormal
stackpath./ComfyUI/Stack/

StackPopImage is the read side of the ComfyUI-Stacker pack. Where StackPushImage saves images to a stack folder on disk, this node pulls the most recent one back into your graph as an IMAGE tensor, ready to wire into anything - an img2img pass, a ControlNet, an image-to-video model, an upscaler. If you've split your pipeline into "render in workflow A, process in workflow B" to avoid loading two big models at once, this is the handoff node at the end of B.

It's the one node in the pack with real decision-making, so let's talk modes.

The inputs that matter

  • key - the stack name, default "default". Must match the key on the push side.
  • stackmode - four choices, and they split into two questions: which item, and does it get removed?
    • Normal - take the newest file and delete it (last-in-first-out). The default, and the honest stack behavior.
    • Peek - take the newest file but leave it in place. Re-runnable, nothing consumed.
    • Pop Bottom - take the oldest file and delete it (first-in-first-out). Useful when you pushed a pile of frames and want to process them oldest-first.
    • Peek Bottom - oldest file, no deletion.
  • fallback_enabled - with this on, an empty stack returns fallback_item instead of crashing.
  • override_enabled - with this on, the node ignores the stack entirely and returns override_item. The author's stated use: change the prompt for a generation without re-pushing a whole new stack. The stack stays untouched.

The output is a single IMAGE tensor (batch size 1). If you pushed a batch of eight images, that's eight PNGs in the stack and eight separate pops to drain them.

How it works

The stack is a folder of timestamped PNGs at ComfyUI/Stack/<key>/. The node lists the files, sorts them, and picks the first or last depending on your mode. In Normal or Pop Bottom it deletes the file after reading - the stack is a consumable queue, not an archive. If the key folder doesn't exist or contains no PNGs and fallback is off, the node raises an exception and the whole generation stops. That's the default behavior, and it will bite you exactly once.

Two mechanical details worth knowing: the node transposes EXIF rotation and converts to RGB (alpha gets dropped), and it returns the image as a normalized tensor like every other ComfyUI image. Clean output, no surprises.

Install and gotchas

Same as the rest of the pack - ComfyUI Manager, search "ComfyUI-Stacker", or:

cd ComfyUI/custom_nodes
git clone https://github.com/concarne000/ComfyUI-Stacker

then restart. No models, no dependencies beyond Python's stdlib.

The two failure modes people actually hit:

  1. Empty stack crash. You push in one run, come back later, and the files are gone (or the run before the pop errored). Turn on fallback_enabled and feed in a placeholder image if you want the workflow to survive.
  2. Destroyed data. Normal mode deletes after reading. If the rest of the workflow fails after the pop, that image is already consumed - the README flags this: pops that happened before an exception stay popped. If you need to re-read, use Peek or keep a copy on the push side.
CategoryConCarne

Inputs (7)

NameTypeDefaultDescription
keySTRINGdefault
fallback_enabledBOOLEANfalse
override_enabledBOOLEANfalse
stackmodeCOMBONormal4 options: Normal, Peek, Pop Bottom, Peek Bottom
stackpathoptSTRING./ComfyUI/Stack/
fallback_itemoptIMAGE
override_itemoptIMAGE

Outputs (1)

NameTypeDescription
IMAGEIMAGE