Inject Noise To Latent
Add controlled noise back into a latent
- latents
- noise
- mask
- LATENT
This is a small, sharp tool for a specific job: taking a latent and mixing a controlled amount of noise into it. Not "generate from noise" - you already have a latent, and you want to perturb it. That comes up more than you'd think once you get into detail passes, latent blending, and the kind of unsampling tricks people use to reintroduce variation without starting over.
Why you'd reach for it
The mental model: everything in a diffusion pipeline is a denoising walk from noise toward an image. If you take a partly- or fully-formed latent and stir a bit of noise back in, you hand the sampler something new to work on - new texture, new detail, a nudge away from the exact result it converged to. Used lightly, it's a way to add grain and break up over-smooth areas. Used with a mask, it's a way to say "re-energize this region and leave the rest." It's also a building block in more advanced graphs where you're compositing or averaging latents and want to reinject stochasticity between stages.
It's a latent-space operation, so it's cheap and it's precise. You're not decoding to pixels and re-encoding; you're doing the math where the model actually thinks.
The inputs that matter
You feed it latents (the one you're modifying) and noise (a second latent - commonly an EmptyLatentImage or another noise source of the same shape), and it hands back a LATENT. The knobs:
strength(default 0.1) - how much noise to mix in. This is the dial you'll actually touch. 0.1 is a gentle nudge; crank it and you're closer to re-noising the whole thing. The range goes absurdly high, but you live in the low decimals.mask(optional) - restrict the injection to a region. This is what turns it from a global effect into a targeted one.normalizeandaverage- control how the noise combines with the existing latent rather than just being piled on top. Leave them off to start; flip them if the result blows out or you want the injection to preserve the latent's overall energy.seedandmix_randn_amount(both optional) - the seed makes the perturbation reproducible, andmix_randn_amountblends in fresh Gaussian noise on top of the noise latent you supplied, for when you want a bit of true randomness in the mix.
Don't overthink the optionals. latents, noise, strength, and maybe mask get you everywhere.
How to install it
It's part of kijai's KJNodes pack.
- ComfyUI Manager - search KJNodes for ComfyUI, install, restart.
- Manual -
cd ComfyUI/custom_nodes && git clone https://github.com/kijai/ComfyUI-KJNodes, thenpip install -r ComfyUI-KJNodes/requirements.txt, restart.
No models, no heavy dependencies. KJNodes is deliberately kept light, and this node is pure tensor math.
Common issues & troubleshooting
Shape mismatch errors. The noise latent has to match the latents you're injecting into - same channels, same spatial size, same batch. If you generated your noise at a different resolution or batch size, that's the error. Make the empty/noise latent match.
Nothing seems to happen. At strength 0.1 into an already-finished latent, the effect can be subtle, and if you then run it through a sampler at very low denoise the sampler smooths it right back out. Turn strength up to see the effect clearly, then dial back to taste.
The image blows out or goes muddy. That's strength too high, or noise stacking without normalize/average. Lower strength first; if you need a strong injection, turn on normalize so the combined latent keeps sane statistics instead of drifting brighter and noisier every pass.
Inputs (8)
| Name | Type | Default | Description |
|---|---|---|---|
| latents | LATENT | — | |
| strength | FLOAT | 0.10000–200 | — |
| noise | LATENT | — | |
| normalize | BOOLEAN | false | — |
| average | BOOLEAN | false | — |
| maskopt | MASK | — | |
| mix_randn_amountopt | FLOAT | 0.0000–1000 | — |
| seedopt | INT | 1230–18446744073709550000 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| LATENT | LATENT | — |