ComfyUI Node

Save Image

Save files where you can actually find them — and get the path back

By 1hew·Created about a year ago·Updated 7 days ago· 33
Save Image
  • image
  • file_path
filenameimage/ComfyUI
auto_incrementtrue
save_outputtrue
save_metadatatrue

The core Save Image node has one big blind spot: it writes your PNG and never tells you where. 1hew's Save Image fixes exactly that - it hands the absolute file path back as a string output, which turns out to be surprisingly useful once you start chaining workflows together.

You'll reach for it when you want to do something with the file after it's saved: log the path into a text node, feed it into a captioner or an "Image to URL" node, pass it to a save-video node so your video muxes the right file, or just keep a run manifest of everything you generated. It also solves the "ComfyUI saved it, where?" game because the file_path output shows up right on the canvas.

How it works

The node takes an IMAGE tensor, writes it to ComfyUI's configured output directory, and returns the full saved path. That directory is whatever folder_paths resolves to - normally <comfyui_root>/output, or your custom --output-directory if you launched with one. The filename field defaults to image/ComfyUI, which produces something like output/image/ComfyUI_00001_.png with subfolder support built in.

The inputs that matter:

  • filename - relative subfolder plus stem, e.g. renders/final. Absolute paths get sanitized into safe relative ones, and the code strips .. so you can't climb out of the output tree.
  • auto_increment - true (default) uses ComfyUI's numbered naming (ComfyUI_00001_ and up, never overwriting); false fixes the name and overwrites the same file each run. The second one is your friend when a workflow is writing an intermediate that a downstream tool re-reads.
  • save_output - false writes nothing to disk and returns an empty path, but the on-canvas preview still updates. Handy for testing a chain before you commit to filling your drive.
  • save_metadata - true (default) embeds the workflow JSON in the PNG, which is how "drag the image back into ComfyUI" reconstruction works. Kill it if you're generating files you don't want carrying their recipe around.

Output: file_path, a STRING with the absolute path of whatever was written. If you feed it a batch, it writes every image and you get back a newline-separated list of paths.

Installing it

Via ComfyUI Manager, search for "ComfyUI 1hewNodes" and hit Install, then restart. Or the manual route:

cd ComfyUI/custom_nodes
git clone https://github.com/1hew/ComfyUI-1hewNodes

then restart ComfyUI. One honest warning: this pack's requirements.txt is heavy - rembg, transparent-background, ultralytics, transformers, opencv - because the same repo ships background-removal and YOLO nodes. You don't need any of that for Save Image, but pip installs it all anyway, and some of it pulls model files on first use. If you only grabbed the pack for the IO nodes, don't be surprised when the first install takes a while.

Gotchas

Because it's an output node, it only runs once the whole graph feeding it finishes - that's normal, not a bug. And the path it returns is absolute, so if you stash it in metadata and later move the ComfyUI folder, old paths go stale. Nothing to worry about day-to-day, just know it's a machine-specific string, not a portable one. If you want the PNG's own workflow embedded so you can drag it back later, leave save_metadata on - turning it off saves a few KB and loses that trick.

Category1hewNodes/io

Inputs (5)

NameTypeDefaultDescription
filenameSTRINGimage/ComfyUI
auto_incrementBOOLEANtrue为 True 时使用 ComfyUI 自动编号规则;为 False 时固定文件名并覆盖。
save_outputBOOLEANtrue为 True 时写入文件;为 False 时不保存到磁盘并返回空路径。
save_metadataBOOLEANtrue
imageoptIMAGE

Outputs (1)

NameTypeDescription
file_pathSTRING