WebUI Bridge Set Latent Mask
Staple a mask onto a latent for mask-aware inpainting
- samples
- mask
- latent
- status
Inpainting only knows where to redraw if the latent you hand the sampler carries a mask. ComfyUI does this with a noise_mask key on the latent - a field most beginners never see because the normal nodes set it for you. WebUI Bridge Set Latent Mask is the node that does it explicitly: it takes a LATENT and a MASK and attaches that mask as the latent's noise_mask, so the sampler regenerates only inside the masked region.
It's the plumbing node of the pack's mask/SAM module. It doesn't detect anything and it doesn't inpaint - it's the middle step between "I have a mask" and "the sampler knows about the mask."
How it works
Feed it samples (a latent from VAE Encode or a previous sampler) and mask. It reads the module config and only acts if either the Mask module or the SAM/Inpaint module is enabled - otherwise it passes the latent through unchanged. When active, it reshapes the mask into the single-channel layout the sampler expects and writes it into a copy of the latent as noise_mask, so your original latent object isn't mutated. The status output tells you which module drove it (SAM/Inpaint or Mask) and the denoise/strength value associated with it.
The connection to the pack's other nodes: the main Bridge node's Mask and SAM settings (strength, SAM inpaint denoise, dilate, etc.) live in module_config, and Inpaint Conditioning is the more capable sibling that also prepares the conditioning and denoise. Set Latent Mask is the lean version when you already have conditioning handled and just need the mask attached.
Inputs and outputs
samples- the LATENT.mask- the MASK, from a mask editor, a SAM/segmenter node, or the Bridge's Image Input.module_config- the settings blob; whether it acts at all depends on the Mask/SAM modules being enabled.- Outputs:
latent(with noise_mask attached) andstatus(which module drove it and at what denoise/strength).
How to install
Part of the ComfyUI-WebUI-Prompt-Bridge pack: ComfyUI-Manager → ComfyUI WebUI Prompt Bridge, or clone into custom_nodes and restart. No models.
Common issues
Two things trip people up. First, module gating: if Mask and SAM/Inpaint are both disabled in the config, this node silently passes the latent through - you set a mask, wired the node, and nothing happened. Check enabled behavior before assuming the mask is being honored. Second, a noise_mask on the latent only matters if your sampler respects it (standard KSamplers do when the latent carries one) - but you still need to sample at a denoise below 1.0, or the mask gets ignored and the whole image is regenerated. The pack's denoise defaults (~0.45) exist precisely because people keep sampling at full strength and wondering why the mask "didn't work."
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| samples | LATENT | — | |
| mask | MASK | — | |
| module_config | STRING | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| latent | LATENT | — |
| status | STRING | — |