MX_AlphaBlend
Composite two images through a real mask, not a faked one
- image1
- image2
- image2_mask
- IMAGE
AlphaBlend is the mask-driven composite node in the MX pack: it fuses two images using a third image as the alpha mask. Where MX_Blend runs a math formula across the whole frame, this one lets a mask decide where each image shows through. Feed it a background, a foreground, and a soft mask, and you get a clean cut-out composite - no lasso, no manual erasing.
It's part of Intersection98/ComfyUI-MX-post-processing-nodes, and it's a natural partner for the pack's mask-makers: generate a selection with MX_Canny or MX_HSVThresholdMask, and composite through it here.
How it works
The core blend is dead simple. In normal mode:
image1 * mask + image2 * (1 - mask)
Wherever the mask is bright, image1 (the background) shows; wherever it's dark, image2 (the foreground) shows; soft mask edges give you soft transitions. The add mode instead does image1 + image2 * (1 - mask), which lightens rather than replaces - useful for adding glow or a highlight pass. A blend_factor (default 1.0) then crossfades between the untouched image1 and the masked composite, so you can pull the whole composite back with one dial. If the two images are different sizes, the node center-crops and resizes image2 and the mask to match image1.
The inputs that matter
image1- the base/background. Dimensions win on mismatch.image2- the layer being cut in. Auto-fit toimage1.image2_mask- the alpha, as an IMAGE tensor. Bright =image1shows, dark =image2shows. Any single-channel mask works; if you have a MASK tensor, convert it with aMaskToImagenode first. The pack's own example workflow does exactly this.blend_mode-normaloradd.blend_factor-0to1, default1.0.
Output is a single IMAGE at image1's resolution.
Install
Standard MX pack install. ComfyUI Manager (search MX or ComfyUI-MX-post-processing-nodes), or:
cd ComfyUI/custom_nodes
git clone https://github.com/Intersection98/ComfyUI_MX_post_processing-nodes
cd ComfyUI_MX_post_processing-nodes
pip install -r requirements.txt
Restart ComfyUI; the node sits under postprocessing/Blends. No models, no downloads.
Where people get burned
This is the one MX node with a real hardware requirement: it moves all three tensors to cuda:0 before blending. That means it needs a CUDA GPU - on a CPU-only or Apple Silicon (MPS) install it will fail rather than fall back, which is worth knowing if you're running the pack in the cloud or on a Mac. Second, the mask is expected as an IMAGE, not a MASK - plugging a MASK tensor in directly is the most common beginner stumble. Third, white-in-mask convention: people often guess bright means "show image2," and this node does the opposite (bright shows image1). If your composite is back-to-front, invert the mask, not the inputs. Get those three straight and it's a very clean little compositor.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| image1 | IMAGE | — | |
| image2 | IMAGE | — | |
| image2_mask | IMAGE | — | |
| blend_factor | FLOAT | 1.000–1 | — |
| blend_mode | COMBO | 2 options: normal, add |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |