Nodes/Masquerade Nodes/Mix Images By Mask
ComfyUI Node Runs on cloud

Mix Images By Mask

Crossfade two images along a mask

By BadCafeCode·Created 3 years ago·Updated 2 years ago· 479
Mix Images By Mask
  • image1
  • image2
  • mask
  • IMAGE

Mix Images By Mask does exactly one thing: blend two images together using a mask as the interpolation weight. Where the mask is white you get image2, where it's black you get image1, and anywhere in between you get a proportional mix. It's the general-purpose sibling of Mix Color By Mask - instead of blending a flat color into an image, you're blending a whole second image in.

This is the node that quietly does the compositing in a lot of masked-editing workflows, and it's often a cleaner alternative to Paste By Mask when you don't actually need the crop/resize logic. If you've already got two full-size images - say, a generated version and the original - and you just want to combine them along a mask without worrying about region sizing, this is the more direct route. It's also the fix people reach for when Paste By Mask's resize behaviors get finicky: mix the full images directly instead of cutting and pasting a sub-region.

The inputs that matter

  • image1 - the base image, shown where the mask is black (or low).
  • image2 - the image blended in, shown where the mask is white (or high).
  • mask - the interpolation weight, per-pixel.

The single output is the blended image.

Because the blend is proportional to the mask's actual value, a soft, feathered mask gives you a smooth crossfade instead of a hard cut - no separate feathering step needed if your mask already has soft edges from a Gaussian Blur or from ClipSeg's natural output. If you want a hard edge instead, round the mask first with Combine Masks (round_result on) or Mask Morphology.

Installing it

Mix Images By Mask is bundled with Masquerade Nodes. Install through ComfyUI Manager (search "Masquerade Nodes") or manually: cd ComfyUI/custom_nodes && git clone https://github.com/BadCafeCode/masquerade-nodes-comfyui, then restart ComfyUI. It's pure pixel math - no models to download, no extra Python dependencies to install.

Common issues

The one real requirement is that image1, image2, and mask all need to be the same resolution - this node blends pixel-for-pixel and doesn't resample anything for you. If you're combining a generated crop with a full-size original, resize the crop back up first (or work with Cut By Mask / Mask To Region / Paste By Mask instead, which handle sizing explicitly). If the blend looks reversed - image2 showing up where you expected image1 - check whether your mask is inverted; a common cause is feeding in a mask meant for "protect this area" when the node expects "reveal this area," which are opposite conventions and easy to mix up when chaining several mask nodes together.

CategoryMasquerade Nodes

Inputs (3)

NameTypeDefaultDescription
image1IMAGE
image2IMAGE
maskIMAGE

Outputs (1)

NameTypeDescription
IMAGEIMAGE