Anima Load Caption Image Batch
Feeds images to the caption model, one task at a time
- TASK_LIST
- images
- IMAGE_RECORDS
- TASK_LIST
- load_log
The pack's caption workflow runs a VLM inside the ComfyUI graph, and a VLM needs tensors, not file paths. AnimaLoadCaptionImageBatch is the bridge: it pulls a batch of images out of one of your training tasks, converts them into a square image tensor, and hands them to the llama-cpp instruct node alongside an IMAGE_RECORDS list that says where each image came from. Without it, the graph would have no idea which image produced which caption.
How it works
The node takes the TASK_LIST from AnimaBatchFolderLoader and picks which task to load from (see task_index below). It then iterates the task's image list, loads each file with PIL (applying EXIF rotation and converting to RGB), and builds a square tensor: it scales the image down to fit within image_size - never up - and letterboxes onto a black canvas, so a 600×1200 portrait becomes a 1024×1024 tensor with black bars. That's deliberate: the VLM just needs to see the image, and a uniform square keeps batch dimensions sane.
The clever bit is IMAGE_RECORDS: a parallel list of dicts holding each image's path, its target caption path, the trigger word, and the task folder. The save node uses those records to map VLM output back to the right .txt file. The node also honors existing captions - with skip_existing_caption = true (default), images that already have a non-empty caption are skipped, so re-running only captions the gaps.
The inputs that matter
- TASK_LIST - required, from the folder loader.
- task_index - which task to load, 1-based:
0means all tasks,1means the first task, and an index past the end returns an error in the log and a blank placeholder tensor. This is the knob you turn to caption one character folder at a time. - max_images - batch size, default 32.
- image_size - square side in pixels, default 1024; range 256–4096. Downscaling only, so bigger is not "higher quality to the VLM," just bigger tensors.
- start_index - offset into the task's image list, for resuming a partial batch.
- skip_existing_caption - true = only uncaptioned images.
Outputs: images (IMAGE tensor, feed to the VLM), IMAGE_RECORDS (feed to the save node), TASK_LIST (passed through), and load_log (a per-file line list - and a WARNING: no images loaded with a blank placeholder if everything was skipped, which is easy to miss and sends a black frame to your VLM).
Installing it
Part of the AnimaForge Windows pack: ComfyUI Manager → "ComfyUI-AnimaForge-Windows", or
cd C:\ComfyUI\custom_nodes
git clone https://github.com/AI-KSK/ComfyUI-AnimaForge-Windows.git
cd ComfyUI-AnimaForge-Windows
powershell -ExecutionPolicy Bypass -File .\scripts\install_windows.ps1
Restart ComfyUI. The caption workflow it feeds additionally needs ComfyUI-llama-cpp_vlm and a GGUF VLM with its mmproj in ComfyUI\models\LLM.
Common issues
The two traps are both silent. First, task_index is 1-based while most ComfyUI index inputs are 0-based - set it to 1 expecting the first folder and you get exactly that, but set it to 0 expecting "the first folder" and you get everything. Second, the blank-placeholder behavior: if every image is skipped (all captioned already) or the load fails, you get a black 1×1×1024×1024 tensor and a warning, not an error - the VLM will happily caption a black square. Check load_log if your captions suddenly all say "dark empty frame." And remember the downscale-only rule: feeding 4096×4096 originals at image_size = 4096 won't give the VLM more detail than 1024 if the source is smaller, it just wastes VRAM.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| TASK_LIST | TASK_LIST | — | |
| task_index | INT | 00–100000 | — |
| start_index | INT | 00–1000000 | — |
| max_images | INT | 321–4096 | — |
| image_size | INT | 1024256–4096 | — |
| skip_existing_caption | BOOLEAN | true | — |
Outputs (4)
| Name | Type | Description |
|---|---|---|
| images | IMAGE | — |
| IMAGE_RECORDS | IMAGE_RECORDS | — |
| TASK_LIST | TASK_LIST | — |
| load_log | STRING | — |