Nodes/Basic data handling/save IMAGE to file
ComfyUI Node

save IMAGE to file

Save your output to a path you choose, in the format you want

By StableLlama·Created about a year ago·Updated 16 days ago· 51
save IMAGE to file
  • images
  • success
  • images
◄path►
◄formatpng►
◄quality95►
◄create_dirstrue►
◄prompt►
◄negative_prompt►
◄use_prefix_modefalse►

Basic data handling: PathSaveImageRGB ("save IMAGE to file") writes an image tensor to disk at a path you control - anywhere on the filesystem, in the format you pick. Core ComfyUI's Save Image node always dumps into the output folder; this one lets you say "put it here, call it this, as a JPEG at this quality."

That freedom is what batch and automation workflows are built on. Point it at a directory generated from the run, add a filename with the pack's string nodes, and you've got full control over where outputs land - something core ComfyUI makes you fight for. Combined with PathGlob and PathLoadImageRGB you can build a whole convert-and-save pipeline that reads from one folder and writes to another, no file dragging involved. The author of this pack runs mass-generation pipelines for datasets, and this is exactly the node that makes organized output possible.

How it works

It takes the first image in the batch (images[0]), converts the tensor back to a Pillow image, and saves it. The important mechanics:

  • Format from the extension and the format input. PNG, JPG/JPEG, WEBP all work. quality (1–100, default 95) applies to JPEG/WEBP. If the path doesn't end in the chosen extension, the node appends it for you - so out + png becomes out.png.
  • JPEG XL is conditional. JXL works only if pillow-jxl is installed; otherwise it prints a note and returns False. That's the one extra dependency in the whole pack, and only for the one format.
  • create_dirs (default on) makes parent folders that don't exist yet - so you can save into a path that hasn't been created without an error.
  • It only saves the first frame of a batch. If your images input is a batch of several, only frame 0 hits disk. Loop per-image if you need each one saved.
  • It's marked as an output node, and returns success (BOOLEAN) rather than throwing on failure - failures print to the console and hand you False.

Inputs and outputs

  • images (IMAGE) - the tensor to save.
  • path (STRING, default "") - destination path.
  • format (STRING, default png) - png, jpg/jpeg, webp, jxl.
  • quality (INT, 1–100, default 95) - for lossy formats.
  • create_dirs (BOOLEAN, default on) - create parent folders automatically.
  • success (BOOLEAN) - whether the save worked.

Installing it

Part of Basic data handling, no dependencies for the core formats - Pillow ships with ComfyUI. ComfyUI Manager → search "Basic data handling" → install → restart. Manual:

cd ComfyUI/custom_nodes
git clone https://github.com/StableLlama/ComfyUI-basic_data_handling

Restart after. For JXL specifically: pip install pillow-jxl-plugin.

Gotchas

The single-frame thing is the trap everyone hits eventually - you feed in a batch expecting a folder of images and get one file. Loop it. The silent failure mode (returns False and logs to console instead of raising) is friendlier but means a failed save can slip past if you don't check success. And remember it's RGB-only: saving a transparency-bearing result needs the pack's RGBA save variant. For organized, format-controlled output, this is the node that replaces "screenshot the output folder" with "point, click, done."

CategoryBasic/Path

Inputs (8)

NameTypeDefaultDescription
imagesIMAGE—
pathSTRINGDestination file path (an extension is added from the format when missing), or a ComfyUI filename_prefix under the output folder when "use prefix mode" is enabled.
formatoptCOMBOpngImage save format (png, jpg, webp, bmp, ...). The list is derived from what the installed Pillow/plugins can write. Drag a STRING onto this to override it.
qualityoptINT951–100Quality for lossy formats (jpg/webp/jxl).
create_dirsoptBOOLEANtrueCreate missing parent directories (plain path mode only).
promptoptSTRINGOptional positive prompt embedded as parameters metadata.
negative_promptoptSTRINGOptional negative prompt embedded as parameters metadata.
use_prefix_modeoptBOOLEANfalseWhen True, 'path' is treated as a ComfyUI filename_prefix under the output folder and files are named/auto-numbered exactly like ComfyUI's "Save Image" node.

Outputs (2)

NameTypeDescription
successBOOLEANTrue when the image was saved successfully.
imagesIMAGEThe saved images, passed through unchanged so they can be used further down the graph.