FL Caption Saver V2
Write image + caption pairs the way LoRA trainers expect
- images
- mask_image
- STRING
If you're building a dataset to train a LoRA, the format is non-negotiable: every image needs a matching text file with the same name - img_001.png next to img_001.txt. Trainers like kohya and ai-toolkit read exactly that layout. FL_CaptionSaver_V2 exists to produce it cleanly from inside ComfyUI, so you can generate or process images and drop them into a training folder with their captions attached in one step.
The "V2" is the grown-up version. It handles both live image batches coming down the graph and images already sitting in a directory, it can assign one shared caption or a different caption per image, it can downsize on the way out, and it won't clobber your existing files unless you tell it to. That covers basically every way a caption-and-save step goes wrong.
How it works
You pick an input mode and a caption mode, point it at a folder, and it writes the image/caption pairs. In single-caption mode every image gets the same text - handy when the whole batch shares a trigger word. In multiple-captions mode it takes a multiline block and assigns lines to images in order, extending or truncating the list to match the image count so you never get a mismatch crash. With overwrite off, it generates unique filenames instead of stomping what's already there.
The inputs and outputs that matter
The required settings:
input_type(Image Input/Directory Input) - process a batch flowing in, or an existing folder of images.caption_input_type(Single Caption/Multiple Captions) - one caption for all, or one per image.folder_name(STRING, defaultoutput_folder) - where the pairs get written.overwrite(BOOLEAN, default true) - off means unique names, never overwrite.downsize_factor(1 / 2 / 3) - divide resolution on save, for hitting a training size.
Then the optionals you wire based on your modes: images (IMAGE) for image input, input_directory (STRING) for directory input, single_caption (STRING) or multiple_captions (multiline STRING) for the text, and mask_image (IMAGE) if you want masks saved alongside.
It's an output node - saving is the point - and it also passes a STRING out (the caption/status) if you want to chain it.
When you'd reach for it
Dataset prep, full stop. Pair it with a captioner (the pack's Ollama or GPT/Gemini vision nodes) to auto-generate captions, then route both into this to lay down a training-ready folder. Or use it manually with a single trigger-word caption when you've already got your images.
Installing it
ComfyUI Manager → ComfyUI_Fill-Nodes → install → restart. Or:
cd ComfyUI/custom_nodes
git clone https://github.com/filliptm/ComfyUI_Fill-Nodes
then restart. No special dependency for this node beyond the pack itself.
Common issues & troubleshooting
Caption count vs image count. In multiple-captions mode the node balances the list to the number of images by repeating or trimming. That's forgiving, but it also means a stray blank line or a miscount silently shifts which caption lands on which image - eyeball the output folder on your first run.
Overwrite is on by default. If you re-run into the same folder_name, it'll overwrite matching files. Turn overwrite off when you're appending to a dataset you care about.
Match input_type to what you wired. Set to Directory Input but connected an image batch (or vice versa) and it looks at the wrong source. The mode and the input you connect have to agree.
Downsize is a divisor, not a target size. Factor 2 halves each dimension; it doesn't resize to a fixed resolution. Pick the factor that lands you near your trainer's bucket.
Inputs (10)
| Name | Type | Default | Description |
|---|---|---|---|
| input_type | COMBO | Image Input | 2 options: Image Input, Directory Input |
| caption_input_type | COMBO | Single Caption | 2 options: Single Caption, Multiple Captions |
| folder_name | STRING | output_folder | — |
| overwrite | BOOLEAN | true | — |
| downsize_factor | COMBO | 1 | 3 options: 1, 2, 3 |
| imagesopt | IMAGE | — | |
| mask_imageopt | IMAGE | — | |
| input_directoryopt | STRING | — | |
| single_captionopt | STRING | Your caption here | — |
| multiple_captionsopt | STRING | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| STRING | STRING | — |