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 4 days ago· 48
save IMAGE to file
  • images
  • success
path
formatpng
quality95
create_dirstrue

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 (5)

NameTypeDefaultDescription
imagesIMAGE
pathSTRING
formatoptSTRINGpng
qualityoptINT951–100
create_dirsoptBOOLEANtrue

Outputs (1)

NameTypeDescription
successBOOLEAN