Inject Noise to Latent SamplingUtils
Precise noise, exactly where you want it
- latents
- noise
- mask
- noised_latents
Diffusion is a noisy business, and sometimes you want your noise, not the sampler's. Inject Noise to Latent takes a latent and a second noise latent and mixes them under your control - by strength, by mask, or by averaging - and hands the result back as a noised_latents output. It's the tool for img2img-style workflows where you want to reuse a specific noise latent, add a controlled amount of chaos, or noise only part of an image.
How it works
The core is one line: noised = latents + noise * strength. But the source does a lot of unglamorous shape-matching first, and that's where the node earns its keep. It handles:
- 4D vs 5D mismatch - image latents are
[B,C,H,W], video latents are[B,C,T,H,W]; it unsqueezes, squeezes, or takes the first frame so the two can broadcast. - Channel and batch mismatch - expands, repeats, or truncates the noise to match the latent's shape.
- Spatial mismatch - resizes the noise with bicubic interpolation to the latent's resolution.
Then the knobs apply, in order:
average(default off) - instead oflatents + noise*strength, it does(latents + noise) / 2, a full blend.normalize- divides the result by its standard deviation, re-energizing the tensor after mixing.mask(optional) - blendsmask * noised + (1−mask) * original, so you can noise only a region and leave the rest untouched. This is the standout feature: region-targeted noise injection for inpainting or regeneration.mix_randn_amount+seed- if you want extra fresh gaussian noise on top (not the noise latent you supplied), this addsmix_randn_amount * randnseeded byseed.
strength runs 0–200 (default 0.1); at 0 you get the original latent back, above 1 you're overdriving the injected noise.
When you'd actually use it
The most common real pattern: capture the noise latent from a KSampler, save it, and re-inject the same noise into a later latent so you can do exact-edit or seed-transfer tricks between runs. The mask input makes it a clean way to add noise to just the background while keeping the subject latent intact - a trick people normally hack together with several masking nodes. If you mostly sample with default settings and never touch latents directly, you can skip this one; it's a power-user node.
Install
ComfyUI Manager → search ComfyUI_SamplingUtils, or:
cd ComfyUI/custom_nodes
git clone https://github.com/silveroxides/ComfyUI_SamplingUtils
then restart ComfyUI. Real deps from requirements.txt: kornia, scipy, pilgram, opencv-python, unifiedefficientloader>=0.5.0. Pack note: README marks it DEPRECATED in favor of ComfyUI-UtilsCollection - this node still runs fine, but latent-utility nodes are exactly the kind that get renamed in a migration, so expect the search to change.
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 |
|---|---|---|
| noised_latents | LATENT | — |