Overlay Inpainted Latent
Composite an inpaint in latent space
- original
- inpainted
- mask
- LATENT
Same job as OverlayInpaintedImage - paste an inpainted result back so only the masked region actually changed - but done in latent space instead of on decoded pixels. Where OverlayInpaintedImage works after your sampler and VAE decode, taking a cropped image and pasting it into a full-size one, this node blends the latents directly, before anything gets decoded to pixels at all.
Reach for this one when your pipeline keeps going after the inpaint: another sampling pass, an upscale that expects a latent, or any further latent-space step. Compositing here and decoding once at the very end avoids decode → composite → re-encode round-trips, which is exactly the kind of unnecessary VAE cycling the "composite after inpainting" best practice warns against in the first place - this node just applies that principle one stage earlier, in latent space rather than pixel space.
How it works
Given the original latent, the inpainted latent, and a mask, it blends the two latents together using the mask as the blend weight: masked regions take the inpainted latent's values, unmasked regions keep the original's. The result is a single latent, ready for further sampling or a single VAE decode at the end of the chain.
The inputs and outputs that matter
Three required inputs:
original- theLATENTbefore inpainting - your starting point, unmodified.inpainted- theLATENTafter your inpainting sampler pass ran.mask- theMASKmarking which region should come frominpaintedversusoriginal.
One output: LATENT - the composited result, decode it whenever you're actually ready for pixels.
How to install it
Ships with the Art Venture pack. ComfyUI Manager: search comfyui-art-venture, install, restart. Manually:
cd ComfyUI/custom_nodes
git clone https://github.com/sipherxyz/comfyui-art-venture
then pip install -r comfyui-art-venture/requirements.txt and restart. No model download.
Common issues & troubleshooting
Composited region doesn't line up with where I painted the mask. mask needs to match the latent's spatial dimensions - remember latents are downsampled relative to the pixel image (typically 8x for SD/SDXL), so a mask built at pixel resolution may need resizing to match the latent before this node can use it correctly.
Unmasked areas changed slightly anyway. That shouldn't happen if the mask is clean - a soft, blurred mask edge will blend proportionally in that boundary region by design, which is usually what you want for a seamless transition. A hard, binary mask should leave the rest of original untouched exactly.
Not sure whether to use this or OverlayInpaintedImage. Use this one if more latent-space work follows the inpaint - another sampler pass, a latent upscale - so you decode only once at the end. Use OverlayInpaintedImage if the inpaint is the last step and you're already working with decoded pixels, or if you cropped with PrepareImageAndMaskForInpaint and need to paste back into full-image coordinates rather than blend two same-sized latents.
Result looks blurry or low-detail in the inpainted region. That's more likely an upstream sampling issue than this node - check your inpaint pass actually ran at adequate resolution and step count before assuming the compositing step introduced the softness.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| original | LATENT | — | |
| inpainted | LATENT | — | |
| mask | MASK | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| LATENT | LATENT | — |