Inject Noise To Latent(InjectNoiseToLatent)
This node accepts two inputs of type LATENT and supports multiple blending modes.
Inject Noise To Latent
The Inject Noise To Latent node receives two inputs of type LATENT and supports multiple blending modes.
The Inject Noise To Latent node is a tool for adding or blending noise into latent space features. Its core functionality allows users to overlay a noise latent tensor onto a target latent tensor with controllable intensity, thereby introducing specific perturbations or stylistic variations during the image generation process.
Node Functionality
This node receives two inputs of type LATENT and supports multiple blending modes. Technically, it defaults to adding the noise tensor multiplied by an intensity coefficient to the target tensor. Additionally, the node provides an "average" mode, which directly takes the average of the two inputs, and a "normalize" option to adjust the standard deviation of the output tensor. It also supports limiting the noise effect to specific areas of the image via a mask (MASK) and can blend in random Gaussian noise to increase variability.
Node Parameter Description - Inject Noise To Latent
Connection Inputs (Inputs)
| Parameter Name | Data Type | Required | Default Value | Range/Options | Description |
|---|---|---|---|---|---|
latents | LATENT | Yes | - | - | latents (input parameter): The target latent representation serving as the base for noise addition. Typically comes from VAE encoding or a previous sampling step. |
noise | LATENT | Yes | - | - | noise (input parameter): The noise latent tensor to be added to the target latent representation. |
mask | MASK | No | - | - | mask (input parameter): An optional mask used to restrict noise application to specific areas of the image. |
Control Parameters (Parameters)
| Parameter Name | Data Type | Required | Default Value | Range/Options | Description |
|---|---|---|---|---|---|
strength | FLOAT | Yes | 0.1 | 0.0 - 200.0 (step: 0.0001) | strength (input parameter): A multiplier controlling the intensity of the added noise, ranging from 0.0 to 200.0 with a step of 0.0001. |
normalize | BOOLEAN | Yes | False | - | normalize (input parameter): Boolean option. If enabled, normalizes the final output latent tensor (divides by standard deviation). |
average | BOOLEAN | Yes | False | - | average (input parameter): Boolean option. If enabled, uses the average of the target latent and noise latent instead of weighted addition. |
mix_randn_amount | FLOAT | No | 0.0 | 0.0 - 1000.0 (step: 0.001) | - |
seed | INT | No | 123 | 0 - 0xffffffffffffffff (step: 1) | - |
Output
| Parameter Name | Data Type | Description |
|---|---|---|
| LATENT | LATENT | LATENT (output parameter): The final latent representation containing the injected noise. |
Usage Scenarios
This node is very useful in image inpainting or stylization workflows. For example, you can first generate a latent representation corresponding to a base image, then connect a noise node that generates specific textures (such as grain, scratches), and finally use this node to inject the texture noise into the base latent at a low intensity, thereby adding subtle texture to the image without completely altering its main content.
Notes
Please note that the input noise latent tensor and the target latent tensor must have exactly the same shape (dimensions); otherwise, the node will report an error. Although the range of the strength parameter is broad (0.0-200.0), typically smaller values (e.g., 0.01-0.5) produce more subtle effects.
Inject Noise To Latent Node Source Code Link
The Inject Noise To Latent node is from the ComfyUI-KJNodes node package.
Comments
Sign in with GitHub to join the discussion.