Image Batch Path 🖼️
Point it at a folder, get back images and their paths, in sync
- IMAGE
- IMAGE_PATH
This is the node that starts the whole auto-captioning pipeline in ComfyUI-JoyCaption. Point it at a folder full of images, and it hands you back two lists that stay in lockstep: the loaded images themselves, and the file path each one came from. That second list is the part a plain image loader doesn't give you, and it's exactly what you need if the next step is writing a caption back to disk next to the original file.
That's the whole reason this node exists as a distinct thing from any generic "load images from folder" node: it's built specifically to feed a batch-captioning loop where each image needs to stay traceable back to its original filename. Load a hundred training images, caption each one with a JoyCaption node, and use Caption Saver to write each caption using the matching path from this node - that's the pattern the pack's README calls "Caption Tools," and it's the fast way to turn a raw folder of images into a captioned LoRA dataset without ever leaving ComfyUI.
The inputs and outputs that matter
image_dir- required, the directory to load from. This is the only input you strictly need to set.batch_size(optional, default 0) - how many images to load. Zero means load everything in the directory. Setting a real number is how you test a workflow on a handful of images before committing to captioning a few thousand.start_from(optional, default 1, meaning the first image) - which image in the folder to begin at. Useful for resuming a large batch job in chunks - process images 1–500 in one run, then setstart_fromto 501 for the next, instead of reprocessing what's already captioned.sort_method(optional, defaultsequential) -sequential,reverse, orrandom. Random is handy for pulling a quick spot-check sample to see how a caption style performs before running the full folder.
Two outputs, both lists: IMAGE is the loaded images, IMAGE_PATH is their file paths as strings, index-matched to the images. Wire IMAGE into your JoyCaption node and IMAGE_PATH into both JoyCaption (if it wants a path context) and Caption Saver - that path is what keeps captions correctly paired to the right file downstream.
How to install it
Search "ComfyUI-JoyCaption" in ComfyUI Manager, or manually:
cd ComfyUI/custom_nodes
git clone https://github.com/1038lab/ComfyUI-JoyCaption.git
cd ComfyUI-JoyCaption
pip install -r requirements.txt
Image Batch Path doesn't touch any model weights and has no GGUF/llama-cpp-python dependency of its own - it's a plain filesystem-and-image-loading node. If your workflow is just "load a folder, caption it, save the captions," you don't need the heavier GGUF install steps unless the JoyCaption node you're pairing it with requires them.
Common issues & troubleshooting
Nothing loads, or it errors immediately. Double-check image_dir is a real, absolute path the ComfyUI process itself can read - not a path that's only valid relative to wherever you happen to be browsing on your own machine. This bites people running ComfyUI as a service or inside a container, where the working directory isn't what you'd expect.
A huge folder makes ComfyUI stall or run out of memory. Because this loads images into a list rather than streaming them one at a time, pointing batch_size: 0 at a folder of several thousand images loads all of them into memory before anything downstream even runs. For large datasets, set an explicit batch_size and chunk the folder across multiple runs using start_from instead of trying to do it all in one shot.
Chunking a batch with start_from skips or repeats images. This only happens if sort_method is set to random - random order isn't guaranteed to be identical between runs, so "start from image 501" can mean a different image each time you run the workflow. If you're chunking a large folder across multiple sessions, stick to sequential or reverse so start_from actually lines up with what you already processed.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| image_dir | STRING | — | |
| batch_sizeopt | INT | 0 | Number of images to load (0 = all images) |
| start_fromopt | INT | 1 | Start from Nth image (1 = first image) |
| sort_methodopt | COMBO | sequential | Image loading order: sequential/reverse/random |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |
| IMAGE_PATH | STRING | — |