AP Bridge Save
Save images and masks together from one node, and let them ride through as outputs
- images
- masks
- images
- masks
A save node is usually a dead end - it consumes a batch and outputs nothing, so if you want to keep the data flowing you have to split the wire. AP Bridge Save is the exception: it writes images and/or masks to disk and passes both through as outputs, so it slots into a pipeline as a tap rather than a wall. It's the sibling of AP Bridge Preview Batch (preview shows, save writes) and it's the natural end-point for the pack's batch video work.
The feature that sets it apart from the built-in Save Image is the mask handling. Built-in save is image-only; here you can save images, save masks, or save them combined into a single file (save_image_mask_together=true), with a compress_level knob for the PNG write. If you're producing inpaint masks, occlusion masks, or anything where the mask is as important as the pixels, this saves you a second save node and keeps the two in lockstep.
The mechanism
It takes optional images and masks, writes the enabled ones into your ComfyUI output directory under filename_prefix (default AP_Bridge/bridge, subdirectories get created as needed), and returns both inputs unchanged as outputs - which is the "bridge" in the name. There are a few deliberate guardrails: save_image_mask_together=true requires both images and masks to be connected (it raises a clear error otherwise, since a combined file with only one of them is meaningless), and the same error style shows up throughout the pack. It's an output node, so it always runs - which means if it's mid-pipeline, the save fires every execution.
The inputs that matter
filename_prefix- output subpath and base name.save_images/save_masks- toggles for what gets written. Both default true.save_image_mask_together- write a combined image+mask file instead of separate ones. Needs both inputs wired.compress_level- PNG compression 0–9 (default 4). Higher = smaller files, slower writes. For large frame batches this matters more than you'd think; masks compress well.
Outputs
images and masks, passed through byte-for-byte - so you can save and keep feeding the same batch downstream, which is the thing built-in save won't let you do without a splitter.
Installing it
Pack-wide install: ComfyUI Manager (search "AP_OpticalFlow"), or
cd ComfyUI/custom_nodes
git clone https://github.com/adampolczynski/ComfyUI_AP_OpticalFlow
python -m pip install -r custom_nodes/ComfyUI_AP_OpticalFlow/requirements.txt
Restart. Dependency: torchvision>=0.15.
Where it fits
End of a frame-by-frame pipeline - the loop output, the stitched inpaint result, the composited flow frame - where you want the sequence (and its masks) on disk while still passing the batch onward for preview or further processing. It's unglamorous but genuinely handy: one node, images plus masks, passthrough included. If you just need to save a single image with no mask and no passthrough, the built-in Save Image is fewer moving parts - reach for the bridge when the batch and the masks are the point.
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| filename_prefix | STRING | AP_Bridge/bridge | — |
| save_images | BOOLEAN | true | — |
| save_masks | BOOLEAN | true | — |
| save_image_mask_together | BOOLEAN | false | — |
| compress_level | INT | 40–9 | — |
| imagesopt | IMAGE | — | |
| masksopt | MASK | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| images | IMAGE | — |
| masks | MASK | — |