Samin Load Image Batch
Stop hand-wiring one image at a time
- image
- filename_text
- image_path
- isTrue
If you're captioning a dataset with this pack's GPT4V node, or running the same workflow over a folder of images, you do not want to be clicking "Load Image" for each file. This node is the batch front-end: point it at a folder, tell it how to step through the files, and it hands you an image plus its filename and path on every queue run. It's a slimmed-down cousin of WAS Suite's "Load Image Batch" - the code is literally derived from it - and it pairs beautifully with SanmiSaveImageToLocal to make a caption-one-folder loop.
How it works
You give it an absolute path and a glob pattern (default *). It scans the folder for images (jpeg, png, tiff, gif, bmp, webp), sorts the paths, and picks a file according to mode:
- single_image - the file at
index. - incremental_image - the next file each time the graph runs; it wraps around at the end.
- number_image - finds the file whose name begins with the digits in
image_number(it strips everything after the first comma, then any non-digits). This is the mode you use withSamin Counter. - random - a random file per run.
The trick under the hood: it keeps its position per-label in a small JSON "database" (was_suite_settings.json) in the pack folder. Change the label and the counter resets - a handy way to run two independent scans over the same folder. It also applies EXIF orientation so phone photos come out the right way up.
Inputs and outputs
You'll realistically touch path, pattern, mode, index or image_number, and label. allow_RGBA_output (default false) converts to RGB - flip to true if you need transparency preserved. rename_images (with number_image mode) renumbers the files in the folder to 000.ext, 001.ext, ... so the digit lookup has something to match - it skips if files are already numeric, and it does rename on disk, so be careful.
Outputs: image (the loaded IMAGE), filename_text (the file's basename, or without extension if you set the optional filename_text_extension to false), image_path (full path - only populated in number_image mode), and isTrue, which is 1 when a numbered image was found and 2 when it wasn't (in which case you get a 512×512 black image back). Wire isTrue into SanmiSaveImageToLocal's isTrue input and missing images silently skip the save - that's exactly what the pairing is for.
Gotchas
The node returns None for the image when a single/incremental/random lookup fails, which can blow up whatever's downstream - check your path and pattern first. The counter state is global, so two workflows sharing a label share a counter. And read this before you panic: the current repo no longer ships this node. The pack was rewritten in April 2025 and now contains only the GPT4V captioner; these "Sanmi Simple Nodes" live only in the repo's history (the old Load_Image_Batch.py). A fresh install won't show it in your node list.
Install
cd ComfyUI/custom_nodes
git clone https://github.com/438443467/ComfyUI-GPT4V-Image-Captioner
Restart ComfyUI. No model downloads, and the dependency list is short (Pillow, torch, numpy). For the full folder-captioning loop you'd pair this with SanmiSaveImageToLocal and the captioner - and keep a copy of the old Load_Image_Batch.py around if you rely on it.
Inputs (9)
| Name | Type | Default | Description |
|---|---|---|---|
| mode | COMBO | 4 options: single_image, incremental_image, number_image, random | |
| index | INT | 00–150000 | — |
| label | STRING | Batch 001 | — |
| path | STRING | — | |
| pattern | STRING | * | — |
| allow_RGBA_output | COMBO | 2 options: false, true | |
| rename_images | COMBO | 2 options: false, true | |
| image_number | INT | 00–150000 | — |
| filename_text_extensionopt | COMBO | 2 options: true, false |
Outputs (4)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |
| filename_text | STRING | — |
| image_path | STRING | — |
| isTrue | INT | — |