Nodes/ComfyUI_Fill-Nodes/FL Caption Saver V2
ComfyUI Node

FL Caption Saver V2

Write image + caption pairs the way LoRA trainers expect

By filliptm·Created 3 years ago·Updated a day ago· 630
FL Caption Saver V2
  • images
  • mask_image
  • STRING
input_typeImage Input
caption_input_typeSingle Caption
folder_nameoutput_folder
overwritetrue
downsize_factor1
input_directory
single_captionYour caption here
multiple_captions

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, default output_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 ManagerComfyUI_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.

Category🏵️Fill Nodes/Captioning

Inputs (10)

NameTypeDefaultDescription
input_typeCOMBOImage Input2 options: Image Input, Directory Input
caption_input_typeCOMBOSingle Caption2 options: Single Caption, Multiple Captions
folder_nameSTRINGoutput_folder
overwriteBOOLEANtrue
downsize_factorCOMBO13 options: 1, 2, 3
imagesoptIMAGE
mask_imageoptIMAGE
input_directoryoptSTRING
single_captionoptSTRINGYour caption here
multiple_captionsoptSTRING

Outputs (1)

NameTypeDescription
STRINGSTRING