Nodes/ComfyUI-BCNodes/Save Image With Caption
ComfyUI Node

Save Image With Caption

Saves images as PNG and, with a caption connected, the caption next to each image under the same name (image_00001_.png + image_00001_.txt), for training datasets. The counter continues from the files in the folder and never overwrites one. Prompt and workflow are embedded unless ComfyUI runs with --disable-metadata. Nothing is drawn under the node.

By 0xBeycan·Created 13 days ago·Updated about 12 hours ago· 1
Save Image With Caption
  • images
  • filename
◄filename_prefixComfyUI►
◄output_folderoutput►
◄caption_file_extension.txt►
◄caption—►
CategoryBCNodes/image

Inputs (5)

NameTypeDefaultDescription
imagesIMAGEThe images to save, as PNG.
filename_prefixSTRINGComfyUIThe file name before the counter (prefix_00001_.png). May hold %date:yyyy-MM-dd% or %Empty Latent Image.width% for values from nodes, %year% %month% %day% %hour% %minute% %second% %width% %height%, %batch_num% (the image's index in the batch), and `sub/` folders.
output_folderSTRINGoutputWhere to save: `output` is ComfyUI's output folder; `output/my_dataset` or `my_dataset` a folder inside it; an absolute path any folder (created when missing).
caption_file_extensionoptSTRING.txtThe caption file's extension, a plain-text format: .txt, .caption, .json, .yaml, .yml, .md, .csv, .tsv, .xml, .log, .ini, .toml.
captionoptSTRINGSaved next to each image under the image's name. Not connected: images only.

Outputs (1)

NameTypeDescription
filenameSTRINGThe file name of the last image saved.