FL Mirror And Append Captions
Double your dataset with mirrored images and matching captions
- directory
This one's a dataset-prep node, not an image-generation node - it belongs to the LoRA/fine-tuning side of ComfyUI's world rather than the sampling side. If you've got a folder of training images with caption .txt files sitting next to them and you want to cheaply double your dataset with horizontal flips, FL_MirrorAndAppendCaptions does the flip and keeps the captions in sync, which is the part people usually forget to automate and end up doing by hand.
What it does and why it's two jobs, not one
Point it at a directory. For every image with a matching caption file, it can (a) create a horizontally-mirrored duplicate of the image with its own sequentially-numbered filename, and (b) rewrite the caption to append or prepend extra text - by default the word "Frame" plus a number, which reads as leftover naming from video-frame datasets but works fine for any sequential batch. Both original and mirrored versions get saved back into the same directory with their captions updated. The reason this matters as one node instead of a manual process: augmenting a LoRA training set by flipping images is a known trick to get more mileage out of a small dataset, but if you flip images without touching captions, you risk directional language ("facing left", "on the right side of frame") going stale in the mirrored copy - this node at least gives you the append/prepend hook to flag which captions came from a flip.
The inputs and outputs that matter
image_directory- the folder of images + caption files to process. Defaults to a Windows-style placeholder path (X://path/to/images), which is just a template - always point it at your real dataset location.caption_extension-.txtor.caption, matching whatever your captioning tool wrote. Get this wrong and the node won't find any captions to touch.create_mirrors(defaulttrue) - turn this off if you only want the caption text-append behavior without generating flipped duplicates.additional_textandtext_position(append/prepend) - the frame-numbering text and where it goes relative to the existing caption.- Output:
directory(STRING) - just passes the same path back out, useful for chaining into a downstream node that expects a directory input (this node is marked as an output node itself, so it also writes files as a side effect, not purely a passthrough).
How to install it
Via ComfyUI Manager: search "ComfyUI_Fill-Nodes" and install, or manually:
cd ComfyUI/custom_nodes
git clone https://github.com/filliptm/ComfyUI_Fill-Nodes
then restart. No special dependency for this node beyond basic file and image I/O, which ComfyUI already has. Fill-Nodes is a large, wide-ranging pack from one prolific solo author, filliptm, covering everything from PDF tools to GPT/Gemini API wrappers to an entire KSampler family - this captioning-and-dataset corner is a small, self-contained slice of it.
Common issues & troubleshooting
Nothing gets created. The most common cause is a caption-extension mismatch - if your files are .caption and the node's set to look for .txt (or vice versa), it silently finds nothing to process. Double-check caption_extension matches your actual files.
This writes directly to your dataset folder - there's no dry-run or preview. Since it's an output node that saves files as a side effect, work on a copy of your dataset first if you're not sure the settings are right, especially before a large training run where you don't want to discover a mistake after the fact.
Mirrored captions read oddly. If your original captions describe spatial direction ("looking left," "light from the right"), a plain flip doesn't rewrite that language automatically - this node handles the append/prepend text, not semantic correction of the caption content. That's a manual pass if directionality matters for your training set.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| image_directory | STRING | X://path/to/images | — |
| caption_extension | COMBO | .txt | 2 options: .caption, .txt |
| additional_text | STRING | Frame | — |
| text_position | COMBO | append | 2 options: append, prepend |
| create_mirrors | BOOLEAN | true | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| directory | STRING | — |