小珠光图像保存
Save or preview with one node, and stop filling output/ with JPGs you didn't mean to keep
- images
Every ComfyUI user knows the moment: you leave a Preview node in while iterating, forget it's there, and come back to four hundred JPGs clogging output/. 小珠光图像保存 (Xiaozhuguang Image Save) is the save node that bakes a preview/save toggle right into the node - flip it to preview while you iterate, flip it to save when you want a keeper. It's built on ComfyUI's PreviewImage, so the canvas display stays snappy, and it writes JPG (compressed) or PNG (lossless) on demand.
The nicest touch is lazy encoding: during a run the node only stores the raw pixels (or a fast compressed preview), and the real full-resolution file is encoded when you right-click to save it. So a long batch run doesn't spend its whole time on PNG encoding you may never need. It also accepts a MASK on its images input (it's a wildcard) and saves masks as black-and-white PNGs, which makes it a handy mask-saver too.
How it works
The backend takes your images, and in save mode writes them into output/ (or a subfolder via output_path) with a fixed xzg-save_#### filename counter. In preview mode it writes a compressed JPG to temp/ and shows it - nothing permanent, nothing in output/. save_format picks JPG or PNG, reduce_lag trades preview resolution (3840px max side vs 6400) for responsiveness on big batches. The metadata story matches the KB's save-node rules: PNG saves carry the workflow chunks; JPG is a derivative. If you want the A1111-style parameters block that CivitAI auto-links, this node is not that - it's a solid in-pipeline saver, not a share-optimized one.
The inputs that matter
images- IMAGE or MASK (wildcard).mode-SaveorPreview. The one you'll flip constantly.save_format- JPG or PNG.output_path- optional subfolder underoutput/.reduce_lag- lower-res previews for big batches.
No outputs - it's a terminal node and a cache endpoint.
Install
From the ComfyUI-xiaozhuguang pack - Manager (search "ComfyUI-xiaozhuguang"), or:
cd ComfyUI/custom_nodes/
git clone https://github.com/xiaozhuguang/ComfyUI-xiaozhuguang.git
Restart. No model downloads.
Gotchas
The preview-vs-save footgun is real: the node serializes the mode, and older workflows that stored a Chinese value ("预览") are handled, but if you've hand-edited a workflow and the mode string is anything unrecognized it defaults to Save - which is exactly backwards from what you wanted. And preview files live in temp/, so they vanish on restart. Keep the master as a PNG in save mode; that's the file with the workflow embedded, per the image-I/O rules.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| images | * | — | |
| output_pathopt | STRING | — | |
| save_formatopt | COMBO | JPG | 2 options: JPG, PNG |
| reduce_lagopt | BOOLEAN | false | — |
| modeopt | COMBO | Save | 2 options: Save, Preview |
Outputs (0)
No outputs