Lazy Mix Images | Deforum
Blend two images with a mask — and skip the branch you don't need
- image1
- image2
- mask
- IMAGE
Lazy Mix Images | Deforum is a mask-based image blend with a twist that makes it worth a second look: if your mask is solid, it doesn't just blend - it skips work entirely. The core is straightforward compositing math, image1 * (1 - mask) + image2 * mask, the same weighted blend you'd build from core nodes. The lazy part is where it gets clever.
You feed it two IMAGE inputs (image1, image2) and a MASK. The output is the blended IMAGE. At runtime the node checks the mask's min and max values. If the mask is all ones, image2 wins outright and the node tells the engine it never needs to compute image1's branch at all; if it's all zeros, image1 wins and image2's entire upstream is skipped. Only when the mask actually has intermediate values does it do the real weighted blend. In a frame loop, that's a free branch selector built on geometry: one frame's mask says "show branch A," the next frame's says "show branch B," and each frame only pays for the side it actually uses.
Where does that shine? Anywhere you have two full render pipelines (two ControlNet setups, an img2img branch versus a text2img branch, a "with face detailer" versus "without") and you want to switch between them frame by frame, or region by region, using a mask that comes from the animation itself. The source even admits it's not handling mixed batch sizes - "Not trying to handle different batch sizes here just to keep the demo simple" is the author's own note - so feed it image batches that match shape. If your two images differ in resolution, match them upstream with a resize node.
A few honest caveats. First, the mask's channel handling is a little raw: a 2D mask gets unsqueezed, and if the mask has fewer channels than the images it repeats them, so a clean single-channel mask is the comfortable input. Second, remember the blending happens in image space, not latent space - if your two branches produce latents and you wanted to blend those, you'd decode first, blend, and re-encode, or reach for the latent nodes in this pack instead. And as with every wildcard/lazy node in this family, a branch that's never selected won't be validated, so a half-broken pipeline will only bite you when the mask actually calls for it.
It ships in deforum-comfy-nodes, so installation is the whole pack: ComfyUI Manager → search "ComfyUI-Deforum" or deforum-comfy-nodes → install and restart, or git clone https://github.com/deforum-art/deforum-comfy-nodes into ComfyUI/custom_nodes. No model downloads and no extra Python packages. The repo used to be XmYx/deforum-comfy-nodes before it moved under the deforum-art org, so don't blink if an old workflow points at the old URL.
If you only ever need "all or nothing," the Lazy Switch | Deforum boolean is simpler. This node's superpower is the partial case - real masks with real gradients, where you genuinely want both branches computed and stitched. Use it for that, and you'll find the lazy skip logic is just a bonus that keeps the all-or-nothing case from wasting your GPU.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| image1 | IMAGE | — | |
| image2 | IMAGE | — | |
| mask | MASK | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |