FL Image Caption Layout PDF
Turn a captioned dataset folder into a contact-sheet PDF
- STRING
- IMAGE
If you've built a captioned image dataset with something like FL_ImageCaptionSaver - a folder full of image.png + image.txt pairs, the layout most LoRA and fine-tuning trainers expect - FL_ImageCaptionLayoutPDF gives you a way to actually look at the whole thing at once instead of clicking through files one by one. It scans the folder and lays every image out into a grid with its caption printed alongside it, both as an on-node preview image and as a real, paginated PDF document.
Why a PDF specifically, and not just a grid image. A single composite image caps out fast once your dataset has more than a handful of items - you either end up with a tiny thumbnail per image or a canvas too large to be useful. A paginated PDF doesn't have that ceiling: it keeps generating pages until every image in the folder has a spot, at whatever thumbnail size you set, which makes it the right tool for actually reviewing a training set of real size - dozens or hundreds of image/caption pairs - rather than eyeballing a handful at a time.
The layout controls. image_directory is the folder to scan (matching image + caption .txt pairs). images_per_row (1–10, default 6) and orientation (horizontal/vertical) control the grid shape. display_size (64–512, default 100) is the thumbnail size in pixels, and caption_height (32–256, default 80) reserves room below or beside each thumbnail for its caption text. font_size (4–32, default 4) sets how big that caption text renders - worth noting the default is genuinely tiny, so bump it up meaningfully if you actually want to read the captions rather than just eyeball the layout. padding (0–100, default 10) spaces cells apart. output_directory and output_filename (default output) say where the finished PDF lands.
Three outputs: a STRING status message, an IMAGE preview of the layout, and a PDF object - the actual document, generated with ReportLab under the hood.
Installing it. Same as every node in this pack - search "Fill-Nodes" in ComfyUI Manager, or:
cd ComfyUI/custom_nodes
git clone https://github.com/filliptm/ComfyUI_Fill-Nodes
- then restart ComfyUI. This one needs ReportLab for the PDF generation and PIL for the preview compositing, both of which the pack's broader PDF and image sub-families already rely on, so they should already be present once Fill-Nodes is installed.
Where people get burned. The obvious one is font_size's default of 4 - leave it alone and you'll get a layout that's structurally correct but effectively illegible; set it to something in the teens or twenties if you actually intend to read the captions off the page rather than just verify the grid looks right. The second is the dataset itself: this node assumes every image in image_directory has a matching .txt caption file, same convention as the rest of this pack's captioning nodes - if some images are missing their caption file, expect those entries to come up blank rather than erroring the whole layout out. And if images_per_row times display_size adds up to a very wide canvas, the preview IMAGE output can get large - that's the expected behavior of a contact sheet at scale, not a sign something's misconfigured.
Inputs (9)
| Name | Type | Default | Description |
|---|---|---|---|
| image_directory | STRING | — | |
| images_per_row | INT | 61–10 | — |
| display_size | INT | 10064–512 | — |
| caption_height | INT | 8032–256 | — |
| font_size | INT | 44–32 | — |
| padding | INT | 100–100 | — |
| output_directory | STRING | — | |
| output_filename | STRING | output | — |
| orientation | COMBO | horizontal | 2 options: horizontal, vertical |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| STRING | STRING | — |
| IMAGE | IMAGE | — |
| — |