Save Mask Bridge (Yogurt Nodes)
Save masks like you save images — and keep them in the graph
- masks
- masks
- width
- height
- batch
- saved_paths
Save Mask Bridge is the mask-flavored version of the pack's Save Image Bridge, and it fills a real gap: stock ComfyUI has no SaveMask node at all. If you've ever wanted to keep a copy of the selection you spent twenty minutes painting, you know the pain - you'd composite the mask onto a colored image, save that, and lose the actual mask data on the way. This node just saves the mask properly.
It writes your MASK tensor to disk as a grayscale PNG (masks are single-channel, so that's a natural fit) and then hands it right back, plus width, height, batch and saved_paths. Same bridge philosophy as its image sibling: the save is a side effect, the data keeps flowing. That's genuinely handy in inpainting and repaint workflows where you want an artifact of the mask region without forking the graph.
The inputs that matter
- masks - the MASK tensor (single mask or a batch).
- output_dir - blank saves to the ComfyUI output directory; set a path to stash masks elsewhere.
- filename_prefix - base name, with
%date:yyyy-MM-dd%and node-value token support. - disable_metadata - set to
trueto skip embedding the workflow in the PNG. - overwrite - off by default, so filenames auto-increment.
- suffix -
.pngor.jpg(for masks, PNG is almost always right - you want lossless). - png_compression (0–9, default 4) and jpeg_quality (0–100, default 100).
Outputs are masks (passthrough), width, height, batch, and saved_paths - the latter being the reliable way to know what got written.
Why you'd bother
Mask artifacts are gold for iterating. Keep the selection from a pass you liked, load it back in later with the pack's Load Mask Path node, and you've got a repeatable inpainting region without re-painting it. And if you're handing masks to another tool or a training script that needs the exact selection as a file, this is the cleanest way out of ComfyUI. The saved PNG is a normal grayscale image, so anything that reads images can use it.
Install
The whole Yogurt pack installs as one:
cd ComfyUI/custom_nodes
git clone https://github.com/yogurt7771/ComfyUI-YogurtNodes.git
cd ComfyUI-YogurtNodes
pip install -r requirements.txt
Or via ComfyUI Manager → ComfyUI-YogurtNodes → install → restart. It's under Yogurt Nodes → IO. Dependencies: numpy, pillow, requests. Nothing heavy.
Gotchas
Masks are single-channel, and JPEG is lossy - if you save a mask as .jpg you'll get compression artifacts that can change which pixels pass your threshold on reload. Keep masks on PNG. And remember overwrite=false is the default: re-running appends counters, so if you're saving to a fixed path for another tool to pick up, flip overwrite on.
Inputs (8)
| Name | Type | Default | Description |
|---|---|---|---|
| masks | MASK | The masks to save. | |
| output_dir | STRING | The directory to save the masks to, leave blank to save to the ComfyUI output directory. | |
| filename_prefix | STRING | ComfyUI | The prefix for the file to save. This may include formatting information such as %date:yyyy-MM-dd% or %Empty Latent Mask.width% to include values from nodes. |
| disable_metadata | COMBO | false | Disable saving metadata to the PNG file. |
| overwrite | COMBO | false | Overwrite existing files. |
| suffix | COMBO | .png | The file extension to save the masks as. |
| png_compression | INT | 40–9 | The level of compression to use for PNG masks. |
| jpeg_quality | INT | 1000–100 | The quality of the JPEG mask. |
Outputs (5)
| Name | Type | Description |
|---|---|---|
| masks | MASK | — |
| width | INT | — |
| height | INT | — |
| batch | INT | — |
| saved_paths | LIST | — |