Save Mask
Save a mask as a PNG — the node that gets your inpaint data out of ComfyUI
- mask
- mask
ComfyUI can save your generated images all day, but masks are another story. A MASK tensor isn't a file - it's a grayscale weight map floating inside your graph, and if you want it on disk you need a node that knows how to write one. Save Mask is that node: it takes a MASK input and writes it to ComfyUI's output directory as PNG files.
Why would you bother? Mask-based inpainting still has a real job in 2026 - the KB's own analysis of the space notes that instruction-editing models drift on repeated edits, while a mask composited back in leaves unmasked pixels bit-identical. If you're building inpaint datasets, tuning a mask-generating pipeline, or just want to eyeball what a segmentation node actually produced, dumping the mask to a PNG lets you inspect it, reuse it in another tool, or feed it back in later via Load Mask (same pack). It's also the natural persistence step for any workflow where the mask is the deliverable.
How it works
It's a terminal node (marked as an output node, so it executes and reports files even at the end of the chain). Give it a mask tensor and a filename_prefix; it writes one grayscale PNG per mask in the batch to ComfyUI's output folder, with ComfyUI's standard auto-incrementing counter appended (Mask_Output_00001_.png, Mask_Output_00002_.png). The mask is scaled from its 0–1 tensor range to 0–255 for the file.
The useful detail: the node passes the mask through unchanged as its mask output. So you can drop it mid-workflow to checkpoint a mask to disk and keep the workflow flowing - no need to fork your graph.
Inputs and outputs
Two inputs, both obvious: mask (MASK) and filename_prefix (default Mask_Output). No outputs you need to wire - is_output_node means it's a sink. The saved files appear in the output folder and in the UI as image results you can click to view.
Install
Part of the ComfyUI Text Processor pack:
cd ComfyUI/custom_nodes
git clone https://github.com/rookiestar28/ComfyUI_Text_Processor.git
pip install -r requirements.txt
Then restart. ComfyUI Manager users: search "ComfyUI Text Processor" and Install. No models, no heavy deps - just simpleeval, requests, beautifulsoup4.
Gotchas
The output is a PNG, which means it's a static snapshot - change the mask pipeline and old files stay behind, so get in the habit of using distinct prefixes per experiment. Also note it writes with ComfyUI's counter, not a fixed name: if you wanted a specific filename you'd rename after the fact. Small gripe for a node that otherwise does exactly one thing and does it cleanly. Pair it with the pack's Load Mask and you've got a full save/reload round-trip for mask data without touching the filesystem.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| mask | MASK | Mask batch to save and pass through unchanged. | |
| filename_prefix | STRING | Mask_Output | Base filename used for numbered PNG mask outputs. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| mask | MASK | Saved mask tensor passthrough. |