Batch Convert Image Files ๐
Normalize a whole dataset folder to one format
- trigger_signal
- converted_file_count
- log
BatchConvertImageFiles walks a folder and converts every image in it to a single format - .jpg or .png - in one shot. It's a dataset-hygiene tool, and it exists because mixed-format image folders quietly cause problems downstream that are annoying to trace.
It's part of ComfyUI-MieNodes, MieMieeeee's utility pack, and it lives in the pack's "Caption Tools" corner - the set of nodes aimed at prepping a LoRA training dataset without leaving ComfyUI.
Why you'd reach for it
You scraped or exported a training set and it's a mess of .webp, .png, .jpeg, and .jpg. Some auto-taggers and trainers handle that fine; some choke on .webp, some silently skip formats they don't like, and you end up with a dataset that's smaller than you think it is. The LoRA-training playbook is blunt that dataset curation beats every training knob - and step one of curation is making the folder uniform so nothing gets dropped for a dumb reason. Convert everything to .png (lossless, safe) or .jpg (smaller, fine for photos) and you've removed a whole class of "why did only 40 of my 60 images train" mysteries.
How it works
Point directory at the folder, pick a target_format (jpg or png - that's the whole dropdown), and run. Every image in the directory gets re-encoded to that format.
The input that decides how nervous you should be is save_original (boolean, default on). Left on, the node keeps your source files and writes the converted copies alongside them - non-destructive, which is the sane default. Turn it off and it replaces originals with the converted versions. Only flip it off once you've confirmed the conversion did what you wanted, because there's no undo.
There's also an optional trigger_signal input, typed *. It carries no data - it's an execution-ordering hook. ComfyUI decides run order from data dependencies, and these file nodes don't take data from the rest of your graph, so if you need "rename first, then convert," you wire the previous node's output into trigger_signal to force the sequence. Ignore it for one-off use.
Outputs are converted_file_count (an INT - how many files it touched, handy for a sanity check) and log (a STRING report). Send converted_file_count into a ShowAnything node and you'll instantly see whether it hit all 60 images or only 40.
Installing it
Install the pack, not the node. ComfyUI Manager โ search ComfyUI-MieNodes (ComfyUI_MieNodes) โ install โ restart. Or:
cd ComfyUI/custom_nodes
git clone https://github.com/MieMieeeee/ComfyUI-MieNodes
and restart. No model download. Nodes appear under the sheep-emoji ๐ MieNodes menu.
Common issues
Watch save_original on the first run. With it off, a bad target choice overwrites your dataset with no going back. Leave it on until you've eyeballed the results, then re-run with it off to clean up the duplicates if you care about disk space.
It runs on the ComfyUI host's filesystem, so the placeholder X://path/to/files needs replacing with a real path that exists on that machine - obvious locally, easy to forget on a remote GPU. If a relative path isn't landing where you expect, resolve it first with GetAbsolutePath.
Conversion doesn't rename or renumber. If your goal is prefix_0001.png-style tidy filenames, that's a different job - pair this with BatchRenameFiles, which also keeps the matching .txt captions aligned when it renumbers.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| directory | STRING | X://path/to/files | โ |
| target_format | COMBO | jpg | 2 options: jpg, png |
| save_original | BOOLEAN | true | โ |
| trigger_signalopt | * | โ |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| converted_file_count | INT | โ |
| log | STRING | โ |