Nodes/ComfyLab Pack/Image Queue (lab)
ComfyUI Node

Image Queue (lab)

Batch-process a whole folder of images, one at a time

By bugltd·Created 2 years ago·Updated about a year ago· 11
Image Queue (lab)
  • index
  • image
  • filename
  • full_path
  • relative_path
  • subfolder
  • index
  • total
folder
pattern*.png, *.jpg
recursivetrue
with_extensiontrue

Image Queue (lab) is the node that turns "I want to run this img2img / upscale / reface workflow on every image in this folder" from a manual slog into a single queue run. It scans a folder, loads each matching image, and hands it to your pipeline one at a time - with the filename, full path, relative path, and subfolder all available alongside, so downstream nodes can name their outputs to match.

It's the image-flavored version of File Queue (lab) (it literally subclasses it) - same scanning behavior, plus it opens the image for you via PIL and converts it to a ComfyUI tensor. If the next node in your graph wants an IMAGE, you want this one over FileQueue.

How it works

Scans once at the start (not per iteration) using glob - comma-separated patterns allowed, symlinks followed, duplicates removed, current folder sorted first. Each iteration loads the next image and hands it over, auto-queuing until the batch is done. Same self-managing loop as every queue in this pack: leave ComfyUI's queue size at 1 and let the node drive.

Inputs:

  • folder - where the images live.
  • pattern - default *.png, *.jpg. Comma-separate for more: *.png, *.jpg, *.webp.
  • recursive - default true.
  • with_extension - default true; off strips extensions from the filename output.

Outputs:

  • image - the loaded image tensor, ready to feed your img2img/upscale/controlnet chain.
  • filename / full_path / relative_path / subfolder - the same path quartet as FileQueue, perfect for building matching output filenames.
  • index / total - 1-based progress.

Optional index (QUEUE_STATUS) input for chaining, as with the other queues.

Where it shines

  • Batch img2img or re-rolls - same seed and prompt across a folder, one queue run.
  • Folder-scale upscaling - feed each image into an upscale pipeline and save with a filename that mirrors the source.
  • Captioning - the image goes to a vision model, the filename goes to a text saver, they stay in lockstep.

Watch the KB's upscaling material before you do a big batch of those - there are sharp edges (e.g. pre-downscaling soft sources, and running a separate face pass) that a batch run will faithfully apply to every image, mistakes included.

Install

ComfyLab Pack installs as one package (nodes carry a "(lab)" suffix). ComfyUI Manager: search ComfyLab Pack, install, restart. Manual:

cd ComfyUI/custom_nodes
git clone https://github.com/bugltd/ComfyLab-Pack.git
cd ComfyLab-Pack
pip install -r requirements.txt

Restart after. No model files; requirements are light (opencv-python, pyyaml, jsonschema and a few small ones).

Gotchas

  • "No file found" errors loudly - nothing matched the pattern, or the folder's empty. Check your pattern and folder path on the machine actually running ComfyUI.
  • One corrupt image kills the run. PIL failing to open a truncated .jpg stops the batch mid-way. It's the classic overnight-run failure: pre-check your folder or expect to resume after fixing the bad file. The queue resets cleanly, so the next run just starts over.
  • Scan is once, at index 0 - files added mid-run won't appear.
  • pattern is a glob, not a regex. *.png, *.jpg works; fancy character classes won't.

Set the folder, set the pattern, run it, and go do something else. That's the whole appeal - and it's why this node quietly makes it into every folder-batch workflow people build with this pack.

CategoryComfyLab/queue

Inputs (5)

NameTypeDefaultDescription
folderSTRINGfolder to scan
patternSTRING*.png, *.jpgfile pattern(s) to match, e.g. '*.jpg' or 'prefix*'. multiple patterns can be defined, separated by a comma
recursiveBOOLEANtruescan recursively?
with_extensionBOOLEANtruekeep or remove file extension
indexoptQUEUE_STATUScurrent queue status

Outputs (7)

NameTypeDescription
imageIMAGEimage
filenameSTRINGfilename
full_pathSTRINGfull path
relative_pathSTRINGrelative path
subfolderSTRINGsubfolder (relative)
indexINTcurrent index
totalINTtotal files