Nodes/ComfyUI-Desert-Pixel-Nodes/DP Save Preview Image
ComfyUI Node

DP Save Preview Image

A save node that also writes caption sidecars

By DesertPixelAi·Created 2 years ago·Updated about a year ago· 25
DP Save Preview Image
  • image
    modeSAVE_IMAGE
    folder_namedp_image_folder
    file_nameimage
    extra_text
    add_size_to_namefalse
    save_captionfalse
    prompt_and_caption_text
    negative_or_other

    This is a smarter Save Image. It saves your output, sure - but it can also flip to preview-only with one toggle, organize files into named folders, tack the resolution onto the filename, and (the part that earns it a place in a workflow) write a .txt caption next to each image. If you've ever prepped a dataset for LoRA training, you know the tedium of pairing every image with a caption file. This node does it as it saves.

    It's one of the save/output nodes in DesertPixelAi's Desert Pixel pack, and it's the one to reach for when you want your outputs organized rather than dumped in a heap.

    How it works

    It's an output node, so it sits at the end of a branch and takes an image in. The mode switch decides its whole behavior: SAVE_IMAGE writes files to disk, PREVIEW_ONLY just shows the result in the UI without saving - the same node doubles as a preview while you're iterating, then saves once you're happy, no rewiring.

    The rest is filing. folder_name and file_name set where and what it's called, extra_text appends a tag, and add_size_to_name stamps the resolution into the filename (handy when you're saving multiple scales of one image).

    The caption feature is the standout. Turn on save_caption and it writes a text file alongside the image, using the optional prompt_and_caption_text (and negative_or_other) inputs as the contents. Feed your prompt into prompt_and_caption_text and you get an image + caption pair per generation - exactly the layout trainers like Kohya and ai-toolkit expect.

    The inputs and outputs that matter

    For everyday saving: mode, folder_name, file_name. For dataset work: save_caption on, with your prompt wired into prompt_and_caption_text.

    There are no outputs - it's a terminal node. Its job is side effects on disk, not passing data on.

    How to install it

    ComfyUI Manager: search Desert Pixel, install, restart. Or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/DesertPixelAi/ComfyUI-Desert-Pixel-Nodes
    

    Restart ComfyUI. Nothing to download. It's under the DP category.

    Common issues & troubleshooting

    Nothing saved. Check mode - if it's on PREVIEW_ONLY, the image only appears in the UI and never hits disk. Flip it to SAVE_IMAGE.

    The caption file is empty or missing. Two things have to be true: save_caption on, and actual text wired into prompt_and_caption_text. The caption text is an input - the node doesn't auto-scrape your prompt for you, so connect your prompt string (or a text node) to that slot.

    Files land somewhere unexpected. folder_name is relative to ComfyUI's output directory; a new name just creates a subfolder there. If you're on a cloud runner and can't find your files, they're in the run's output area under that folder name, not in your local filesystem.

    Preview looks great, disk file looks different. It shouldn't - but if you've got add_size_to_name on and are saving several passes, you may be looking at a different scale's file. The size suffix is there precisely to tell them apart.

    CategoryDP/image

    Inputs (9)

    NameTypeDefaultDescription
    modeCOMBOSAVE_IMAGE2 options: SAVE_IMAGE, PREVIEW_ONLY
    imageIMAGE
    folder_nameSTRINGdp_image_folder
    file_nameSTRINGimage
    extra_textSTRING
    add_size_to_nameBOOLEANfalse
    save_captionBOOLEANfalse
    prompt_and_caption_textoptSTRING
    negative_or_otheroptSTRING

    Outputs (0)

    No outputs