ComfyUI Node

XImageSave

A save node that keeps your metadata and makes your filenames sane

By Xz3r0-M·Created 8 months ago·Updated about 6 hours ago· 13
XImageSave
  • image_or_mask
  • image_or_mask
  • save_path
filename_prefixComfyUI_%Y%-%m%-%d%_%H%-%M%-%S%
subfolderImages
compression_level5
enable_previewtrue

ComfyUI's default save node is fine, but it has two long-standing annoyances: it doesn't let you control the subfolder cleanly, and a lot of users find themselves renaming outputs by hand because the generated names tell you nothing. XImageSave is the pack's replacement: a save node with a real filename template, a subfolder field, PNG compression control, and proper workflow metadata embedding. The workflow-included culture is a big part of ComfyUI - an image saved with its prompt embedded is one you can drag back into the canvas and rebuild - so a save node that gets metadata right matters more than it sounds.

How it works

It accepts image_or_mask (MatchType, so masks work too), writes a PNG to ComfyUI/output/<subfolder>/, and embeds the workflow as PNG metadata the way ComfyUI's built-in saver does - the prompt JSON and any extra_pnginfo (workflow, parameters) get serialized into the file. compression_level (0–9, default 5) trades CPU for file size, and enable_preview decides whether the node shows a preview after saving.

The filename and subfolder both support the pack's datetime placeholders - %Y% %m% %d% %H% %M% %S% - so the default ComfyUI_%Y%-%m%-%d%_%H%-%M%-%S% gives you ComfyUI_2026-08-16_143052.png. You can also pair it with XDateTimeString for a custom token stream, or just type a literal prefix. There's a security detail worth knowing: the author explicitly sanitizes filename and path inputs against traversal, and subfolders must not contain path separators. That's why you set subfolder to a plain name like Characters rather than nested/path.

Inputs and outputs

  • image_or_mask - the image or mask to save.
  • filename_prefix - template with datetime placeholders.
  • subfolder - where under output/ it lands (no separators).
  • compression_level - PNG compression 0–9.
  • enable_preview - show preview after saving.

Outputs: image_or_mask (passthrough, so the node doesn't end your chain) and save_path (relative to the output dir - handy to log with XDataSave).

Installing it

Part of ComfyUI-Xz3r0-Nodes. ComfyUI Manager: search ComfyUI-Xz3r0-Nodes, or:

cd ComfyUI/custom_nodes
git clone https://github.com/Xz3r0-M/ComfyUI-Xz3r0-Nodes.git
cd ComfyUI-Xz3r0-Nodes
pip install -r requirements.txt

Restart ComfyUI. No FFmpeg needed for image saving.

Gotchas

The PNG metadata is the thing to verify - if you post an image and people ask for the workflow, that's this feature working. Just don't assume every PNG-save path in your graph embeds it; only nodes that explicitly write pnginfo do. Second, remember the sanitization cuts both ways: a slash in your subfolder fails rather than quietly creating nested dirs, and the author's guidance is to stick to plain text plus datetime tokens - no weird symbols. And one performance note: at compression 9, big PNGs save noticeably slower for very little size gain; 5 is a sensible default, and you can crank it down when saving a batch.

Category♾️ Xz3r0/File-Processing

Inputs (5)

NameTypeDefaultDescription
image_or_maskCOMFY_MATCHTYPE_V3Input image or mask
filename_prefixSTRINGComfyUI_%Y%-%m%-%d%_%H%-%M%-%S%Filename prefix, supports datetime placeholders: %Y%, %m%, %d%, %H%, %M%, %S%
subfolderSTRINGImagesSubfolder name (no path separators allowed), supports datetime placeholders: %Y%, %m%, %d%, %H%, %M%, %S%
compression_levelINT50–9PNG compression level (0=no compression, 9=maximum compression)
enable_previewBOOLEANtrueShow image preview on this node after saving when enabled

Outputs (2)

NameTypeDescription
image_or_maskCOMFY_MATCHTYPE_V3Original input image or mask (passed through)
save_pathSTRINGSaved file path relative to ComfyUI output directory