Latent Blend π
Blending Latents Like Photoshop, But Nobody Can See What You're Doing
- latent_a
- latent_b
- mask
- latent
- blend_info
Latent Blend does to two latents what a Photoshop layer blend does to two images - except the two inputs are compressed VAE tensors, so you're blending the underlying representation of two images rather than the pixels. That's the trick and the trap at once: it happens before decoding, so what comes out is a genuinely new latent, not a composite. Sample it and you get an image that's neither A nor B but something the model thinks sits between them. Same idea as Latent Interpolate, but that node walks a path from A to B frame by frame; this one fuses them into one latent, then you sample once.
How it works
Pick a blend_mode and a ratio, and it does the math element-wise on the tensors. The menu is a mix of plain and Photoshop-flavored:
- lerp -
A*(1-ratio) + B*ratio. The boring, predictable one, and often the right one. - add / subtract / multiply - the arithmetic primitives.
- screen, overlay, hardlight, difference - the classic compositing modes, applied to normalized latent values.
- spatial_mask - the interesting one: use an actual MASK to blend spatially, A outside the mask, B inside. That's latent-space region swapping without a trip to pixel space.
strength scales how hard the blend applies (1.0 = full blend, lower = closer to A). normalize_output renormalizes the result afterward - worth trying on if the output comes out of range and downstream looks washed out. There's also a blend_info text output that tells you what it actually did, which is handy when you forget which mode you left set.
Inputs and outputs that matter
- latent_a / latent_b - two LATENTs. Should be the same shape (same model family and resolution) or the math gets weird.
- blend_mode - the dropdown above.
- ratio - 0 to 1, which input wins.
- mask (optional) - only used by
spatial_maskmode.
Outputs are latent and blend_info. Wire latent into a KSampler with a low denoise, or straight to VAE Decode if you want to see the raw blend.
Where it earns its keep
The classic use is style mixing: generate A with one prompt, B with another, then blend in latent space and sample at low denoise to get a composition that borrows structure from A and mood from B. Because it's a latent-space operation, the blend happens where the model can still "fix" it during sampling - a pixel-space blend leaves a hard seam you'd have to inpaint. The honest caveat: latent channels aren't RGB. A "screen" blend at ratio 0.5 isn't a predictable 50% color mix; it's an approximation of one. Treat modes other than lerp and spatial_mask as experiments, and keep the strength low until you see what they do.
Install
Same as the rest of OmniNodes - pure PyTorch/NumPy, no extra installs:
cd ComfyUI/custom_nodes
git clone https://github.com/TensorVizion/OmniNodes
Restart ComfyUI and find it under TensorVizion/Latent. ComfyUI Manager (search "OmniNodes") is the easy route. You'll know it loaded when the terminal shows [OmniNodes] β
Loaded.
Troubleshooting
- Output looks like static or flat gray. The blend pushed values outside the latent's normal range. Turn on
normalize_output, or lowerstrength. - Spatial mask ignores the mask.
spatial_maskis the only mode that reads themaskinput - if you've got a mask connected but the mode is set tolerp, it's silently ignored. - A and B are different resolutions. Resize the latents so they match, or the element-wise math will fail or produce garbage. Latents from the same workflow usually already match.
If you're coming from image-space blending, expect a discovery curve: the first few blends will surprise you. Lower the strength, run it through a cheap sample, and build intuition from what actually comes out instead of what you'd guess from the mode name.
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| latent_a | LATENT | β | |
| latent_b | LATENT | β | |
| blend_mode | COMBO | 9 options: lerp, add, subtract, multiply, screen, overlay, +3 | |
| ratio | FLOAT | 0.500β1 | β |
| strength | FLOAT | 1.000β3 | β |
| normalize_output | BOOLEAN | false | β |
| maskopt | MASK | β |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| latent | LATENT | β |
| blend_info | STRING | β |