Draw Gaussian Noise On Image
Fill a masked region with subject-matched noise
- image
- mask
- images
Small, sharp utility. It takes an image and a mask, and fills the masked area with Gaussian noise - but not just any noise. The noise is sampled to match the mean and variance of the unmasked (subject) region, so it blends statistically with what's left instead of looking like a gray static box slapped over your image. The node description says exactly this: it "fills the background (masked area) with Gaussian noise sampled using the mean and variance of the subject (unmasked) region."
Despite living in this pack, it's filed under KJNodes/masking - it's a general image-prep helper from Kijai's toolkit, not Wan-specific. You'll reach for it when you want to destroy a region's content while keeping the overall tone/color statistics intact.
How it works and why you'd want it
The common use is background replacement prep for I2V or inpainting. Say you have a subject on a background and you want the video model to reimagine the background rather than cling to the original. If you leave the old background in, the model anchors to it. If you fill it with flat color or plain noise, you introduce a hard tonal edge and off-palette values that the model then has to fight. This node's trick is that the noise carries the same brightness and contrast statistics as your subject, so there's no jarring seam - the model sees "something needs generating here" without a color shock.
Mechanically: it measures mean and variance inside the unmasked pixels, generates Gaussian noise with those statistics, and paints it into the masked pixels. Simple, deterministic given a seed, cheap.
The inputs and outputs that matter
image(IMAGE) - the source.mask(MASK) - the region to overwrite with noise. Masked = gets filled; unmasked = the subject whose statistics are borrowed and which is left untouched.seed(optional, default 0) - noise is random, so the seed makes it reproducible. Set it if you want the same fill twice.device(optional, defaultcpu) - where the noise is generated.cpuis the default and fine;gpuif you're batching many frames and want it off the CPU.
Output: images (IMAGE) - your image with the masked region replaced by matched noise, ready to hand to an encode / I2V / inpaint step.
How to install it
ComfyUI Manager → search ComfyUI-WanVideoWrapper, install, restart. Manual:
cd ComfyUI/custom_nodes
git clone https://github.com/kijai/ComfyUI-WanVideoWrapper
pip install -r ComfyUI-WanVideoWrapper/requirements.txt
then restart. No models, no weights, no heavy dependencies - it's plain tensor math on an image and a mask.
Common issues & troubleshooting
The mask is inverted. This is the one that bites: the node fills the masked area and preserves the unmasked area. If your subject got noised over and the background survived, invert your mask.
The noise still looks off against the subject. It matches global mean and variance, not local texture or hue gradients. On an image with a strong color gradient or two very different tonal zones, a single matched noise fill can still read as flat. That's expected - it's a statistical match, not a content-aware fill. For finer blending, feather the mask edge.
Results change every run. Set the seed. Default 0 is fixed, but if something upstream is randomizing, pin it here.
Node isn't where I expect in the menu. It's under KJNodes/masking, not with the WanVideo nodes - it's a general masking helper that happens to ship in this pack.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| mask | MASK | — | |
| deviceopt | COMBO | cpu | Device to use for processing |
| seedopt | INT | 00–18446744073709550000 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| images | IMAGE | — |