load images (queue tools)
Feed a folder to ComfyUI one batch at a time (and know when it's empty)
- IMAGE
- preFramed
- index
- hasNext
If you've ever tried to run a frame-interpolation or video workflow over a folder of frames, you know the wall: ComfyUI's default Load Image grabs one file, and cramming six hundred of them into the graph at once melts your VRAM and turns every queue run into a loading screen. load images (queue tools) - the only node in qwixiwp's queuetools pack - is a workaround for exactly that. It reads a folder, hands you a batch of images, and then remembers where it left off, so the next time you hit Queue it serves you the next batch. Queue once, get batch 1. Queue again, batch 2. Keep going until hasNext goes false.
Despite the pack name there's no API call, no key, no queue server - it's plain Python walking a directory. The "queue" is ComfyUI's own queue button.
How it works
The node keeps a per-instance iterator keyed by the node's hidden uniqueId, and its IS_CHANGED returns NaN so it always re-executes every time a prompt runs - which is what advances it. Each run it sorts the folder alphabetically, skips dotfiles and anything that isn't .png/.jpg/.jpeg/.bmp, verifies each image with PIL, and silently skips corrupt files. To know whether the folder has more to give, it actually loads batchSize + 1 frames, checks, and pops the extra one - that peek is the hasNext output.
The bit that makes it video-friendly is preFrame (default on). When you're not at the very start, it grabs the single last valid frame before the current batch and prepends it to your images, so an interpolation or AnimateDiff-style workflow has a continuity anchor between batch boundaries. You'll see this in the preFramed output: 1 when a preframe was added, 0 when it wasn't - and it's always 0 on the first batch.
The inputs and outputs that matter
You only really set a handful of these:
- directory - the one required input. It's relative to
ComfyUI/input/, somyframesmeansinput/myframes. Empty string means the input folder root. It does not take an absolute path; the code prependsinput/no matter what you type. - batchSize - frames per run, default 8. Feed this to match whatever your model likes.
- preFrame - default on; turn it off if you're just upscaling stills.
- reset / resetStartAt - flip
reseton to jump back toresetStartAt(default 0) instead of restarting ComfyUI.
Outputs: IMAGE (a batch tensor ready to wire into VAE encode or a video model), preFramed (INT 0/1), index (INT - where the current batch starts), and hasNext (BOOLEAN - true when more frames remain). Wire hasNext into a conditional and the next stage of your graph can stop itself when the folder's done.
Install
Dead simple, because the pack has no dependencies worth worrying about - no requirements.txt, no model downloads, just numpy/torch/PIL that ComfyUI already ships. Via Manager: search queuetools and install. Or:
cd ComfyUI/custom_nodes
git clone https://github.com/qwixiwp/queuetools
Then restart ComfyUI. It should print Queue Tools: Successfully Loaded.
Where people get burned
- Sort order is alphabetical, not numeric.
frame_2.pngsorts beforeframe_10.png. Zero-pad your frame names (frame_001.png) or your "sequence" arrives in a surprising order. This is the trap that'll bite first. - The batch isn't always
batchSize. WithpreFrameon, the IMAGE tensor holdsbatchSize + 1images whenever there's a preframe. If some downstream node demands an exact count, account for it. - Iteration state is in-memory. Restarting ComfyUI resets every node instance to the start - that's also your cleanest "start over", alongside
reset. - Each node instance tracks its own position. Duplicate the node and the copy starts from frame 0 independently. Useful, or a quiet surprise.
- It's unmaintained. One commit from February 2024, a one-line README, never touched since. The code is ~120 lines of plain Python that touches nothing fragile, so it'll likely keep working, but you're adopting it as-is. If you want a maintained alternative, WAS Node Suite's Load Image Batch does the folder-batch job, and Video Helper Suite is the better bet when you're starting from an actual video file instead of frames.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| directory | STRING | — | |
| batchSizeopt | INT | 8 | — |
| preFrameopt | BOOLEAN | true | — |
| resetopt | BOOLEAN | false | — |
| resetStartAtopt | INT | 0 | — |
Outputs (4)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |
| preFramed | INT | — |
| index | INT | — |
| hasNext | BOOLEAN | — |