Shima Batch Image Processor
Feed a whole folder through your workflow, one image at a time
- image
- mask
- parent_path
- relative_path
- filename
- current_index
- total_count
ComfyUI is famously awkward about processing a folder full of images one at a time - the usual workaround is a loop node or a Python node that reeks of duct tape. Shima Batch Image Processor is the pack's answer: a node that sits in your graph, pulls an image from a directory each run, advances to the next, and keeps the queue rolling until the folder's done. Set it up once, hit Queue, and let it grind.
How it works
Each execution scans the folder, filters files, picks one by index, and hands it to the rest of your graph. The index_mode decides how the selection moves:
- increment - next file each run (the default, and the one you want for batch work).
- decrement - backwards.
- fixed - always the same file (set by the
indexwidget). - randomize - random pick, useful for sampling a folder.
auto_queue is the interesting bit. ComfyUI caps the queue at 100 runs, which is death for a 500-image batch. With auto-queue on, the node sends a frontend event that queues the next run automatically when more files remain, blowing past that limit. That's the whole reason the node description insists you keep it on.
The inputs that matter
- directory - the source folder (required).
- safety_path - required, no exceptions. This is your EXPORT folder, and the node hard-refuses to run if it's empty or identical to
directory. It exists to stop a feedback loop where your outputs get re-ingested as inputs. Respect it. - path_filter - glob patterns to include, default
*.png, *.jpg, *.jpeg, *.webp. - path_exclude - glob patterns to skip, default
*_raw*, *_preview*, *_pose*, *_depth*, *_line*. The tooltip's warning is literal: leaving it alone is crucial to prevent loops, because otherwise the very outputs your workflow writes get swept back in as next inputs. - recursive - scan subfolders.
- index - manual index, used as a start point in increment mode.
The outputs that matter
- image - the loaded file, RGB.
- mask - here's a gotcha: it's the inverted alpha channel. Transparent pixels come out as 1.0, opaque as 0.0. If you're feeding this into an inpaint pipeline, check the polarity before trusting it.
- filename / parent_path / relative_path - so you can name your outputs consistently with the source.
- current_index / total_count - progress tracking, e.g. for building a filename.
Installing it
Part of the Shima pack - ComfyUI Manager → search Shima, or:
cd ComfyUI/custom_nodes
git clone https://github.com/KDB-USJP/shima_wf.git Shima
Restart ComfyUI. First launch auto-installs Python deps and the pack's companion repos (ComfyUI-Impact-Pack, cg-use-everywhere).
Common issues
- "You must specify a safety_path" - read it again: the node refuses to run without one, and the source folder must differ from the export folder. This is a feature, not a bug.
- "Batch Limit Reached!" - the node raises an error when
indexpasses the last file. That's the intended end-of-batch signal; resetindexto 0 to start over. Don't treat it as a crash. - Your outputs get reprocessed as inputs. You ignored
path_excludeor pointedsafety_pathinsidedirectory. Both of those defaults exist to stop exactly this. - 100-run queue cap trips anyway -
auto_queueis off. Turn it on; the whole point is that it bypasses the limit.
One design note: this node feeds a folder in sequentially, one run at a time, not as a parallel batch. That's the trade-off for working inside an existing graph instead of a separate batch script - slow but steady, and you can watch every image go through.
Inputs (8)
| Name | Type | Default | Description |
|---|---|---|---|
| directory | STRING | Path to image folder | |
| index_mode | COMBO | increment | How to select the image index |
| index | INT | 00–18446744073709550000 | Manual index (used when mode is 'fixed' or as start point) |
| recursive | BOOLEAN | false | Scan subfolders |
| auto_queue | BOOLEAN | true | Automatically queue next batch if current run finishes but images remain. |
| path_filter | STRING | *.png, *.jpg, *.jpeg, *.webp | Glob patterns to include (comma separated) |
| path_exclude | STRING | *_raw*, *_preview*, *_pose*, *_depth*, *_line* | Glob patterns to exclude (comma separated). Crucial to prevent loops! |
| safety_path | STRING | REQUIRED: Your EXPORT path. Must be different from directory! |
Outputs (7)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |
| mask | MASK | — |
| parent_path | STRING | — |
| relative_path | STRING | — |
| filename | STRING | — |
| current_index | INT | — |
| total_count | INT | — |