ComfyUI-Batch-Process Introduction
ComfyUI-Batch-Process is a collection of nodes for working with groups of text files, images, videos, LoRAs, masks, and 3D assets in ComfyUI. It helps when your creative workflow involves many files: for example, making images from a folder of prompts, saving each result with a matching caption, or previewing several 3D models.
The nodes cover different parts of that workflow. Loaders choose files and pass them into ComfyUI. Text and mask tools adjust the material you are working with. Grouping and filtering nodes help prepare assets for other nodes. Savers write finished images, videos, and 3D models to files.
How ComfyUI-Batch-Process Works
Think of a batch loader as a file picker connected to your ComfyUI workflow. You point it at a collection of files and set rules for which files to consider. Depending on the loader, you can then work through the matching files in order or select one at random.
For example, you could keep one prompt per TXT file. TXT Batch Loader selects a file and provides both its text and its filename without the .txt extension. Your workflow can use the text as a prompt and use the filename to identify the saved result. Similarly, Image Batch Loader can select images from a folder and provide either an individual image or a group of images for later processing.
A batch means multiple values passed together. Some downstream nodes need every image in a batch to have the same dimensions. When Image Batch Loader or Any Batch Group combines images of different sizes, it adds black space around the smaller images, centered within a common size. If keeping each image’s original dimensions matters, use the image loader’s image list output instead of its combined batch.
ComfyUI-Batch-Process Features
Text files and text editing
TXT Batch Loader reads UTF-8 TXT files. You can filter by filename or content, use natural sorting, select a range of files, move through files incrementally, or make a reproducible random selection with a seed. It outputs the selected file’s text and its filename without the extension.
Text Modify Tool can search, replace, or remove complete text, a filename prefix, or a filename suffix. It can use a delimiter you specify or detect one automatically. This is useful when filenames contain parts you want to separate or remove before using them elsewhere in a workflow.
Images and captions
Image Batch Loader supports PNG, JPG/JPEG, WebP, BMP, and GIF files. It can filter filenames, search subfolders, sort naturally, limit selection to an index range, and operate in sequential or random mode. Its outputs include the selected image, filename, image count, a combined image batch, and an image list.
Image Batch Saver saves images and, optionally, TXT captions. You can configure the output path, filename prefix and suffix, delimiter, counter, file format, workflow metadata, frame range, and animation frame appending. These options help you keep related images and captions organized and give repeated outputs distinct names.
Videos and 3D assets
Video Batch Saver saves ComfyUI video objects and optional TXT captions. It offers settings for output paths, filenames, containers, codecs, counters, and workflow metadata. The available result depends on the codecs required by your selected video format.
3D Model Batch Saver accepts MESH objects, File3D objects, supported file paths, and lists of 3D models. It writes MESH objects as GLB files; file-based models retain their original format. 3D Model Batch Preview creates ComfyUI previews for a single model or a batch of models, so you can inspect assets within your workflow.
LoRAs, grouping, and masks
LoRA Batch Loader selects LoRAs stored as .safetensors, .ckpt, .pt, or .bin files. It supports filename filtering and incremental or random selection. You can set model and CLIP strengths separately, then use its patched model, patched CLIP, and selected filename outputs in the rest of your workflow.
Any Batch Group combines compatible values, including images, image-tensor lists, latents, strings, numbers, MESH objects, and File3D objects. When it groups differently sized images, it center-pads them automatically.
The mask nodes provide four focused operations:
- Mask From Batch: Select a range of masks from a batch.
- Mask Repeat Batch: Repeat masks along the batch dimension.
- Mask Batch Copy: Create two independent copies of a mask batch.
- Mask Batch Composite: Concatenate two mask batches.
Filtering stale assets
Asset Filter helps with workflows where ComfyUI retains asset slots from earlier runs. It traces each slot back to its source filename: slots with changed names pass through, while slots with unchanged names are dropped. On the first run, it uses the freshness_hours file-modification window, which defaults to 24 hours. A pure re-run reuses the previous selection. If filtering would remove every slot, all slots pass through as a fallback.
Inputs appear as you connect them, up to nine images and three videos. Outputs are named image_0 through image_8 and video_0 through video_2, alongside image_count and video_count. Each output corresponds to the input at the same position and carries one asset at its original resolution; an unconnected or filtered slot outputs None. The zero-based image names line up with MiniMax H3 references, such as image_0 to ref_image_0.
Connect the filter’s outputs to a reference consumer once and leave them connected, provided that consumer skips None values and runs with the remaining assets. Do not send a potentially empty slot directly to PreviewImage or SaveImage: those consumers do not tolerate None.
ComfyUI-Batch-Process Filename Templates and Indexes
Naming saved images from a TXT file
ComfyUI normally fills filename placeholders from input widgets. This extension also supports the runtime filename output of TXT Batch Loader. For example, this Save Image prefix combines the selected TXT filename with a seed:
D_%TXTBatchLoader.filename%_%EasySeed.seed%
With forest_scene.txt and seed 197152849854180, it resolves to:
D_forest_scene_197152849854180
The name inside a placeholder can be the loader’s class type, display name, workflow title, or Node name for S&R value. For a loader named Text Source, for example, you can use %Text Source.filename%.
The placeholder resolves from the loader when it runs in the same prompt as the saver. If ComfyUI uses a cached loader output instead, the extension uses the most recently recorded filename.
Selecting an index range
The loaders’ common index rules are:
start_index = 0starts at the beginning.end_index = 0continues through the final item.- Positive start and end values are 1-based; a positive end value is included in the selection.
For an incremental loader, turn on reset_on_queue when you want it to start again from the first item that matches your filters.
Troubleshooting ComfyUI-Batch-Process
The loader is not selecting the file I expected. What should I check?
- Check the filename or content filters and confirm the file matches them.
- Check whether recursive search is enabled if the file is in a subfolder of an image collection.
- Review the sort order and index range. Positive index values start at 1, and the end value is inclusive.
- If you are using an incremental loader and want to begin again, turn on
reset_on_queue.
Why do some images have black borders in a combined batch?
The images have different resolutions. The extension centers them within a common size and fills the extra space with black. If you need to keep their individual dimensions, use Image Batch Loader’s image list output rather than its combined image batch.
Why is a filename placeholder using an earlier TXT filename?
ComfyUI may have reused the TXT loader’s cached output. In that case, the placeholder uses the most recently recorded filename. Check that the loader runs in the same prompt as the saver when you need the filename from the current selection.
Why does an image preview or save node fail after Asset Filter?
A filtered or unconnected output slot produces None. PreviewImage and SaveImage cannot accept that value. Connect those nodes to a slot you know will contain an image; use a reference consumer that skips None for slots that may be filtered.
Why can’t I save a video in my chosen format?
Video saving requires the codecs for the selected format. Check that the codecs needed by your chosen container and codec settings are available.
Learn More about ComfyUI-Batch-Process
The ComfyUI-Batch-Process repository is the source for the extension and its node documentation. The original README identifies the package version as 1.2.1.
