Image Mask Blend
Drop a layer image into a mask-shaped spot, blend modes included
- background_image
- layer_image
- layer_mask
- image
This is the compositing node you reach for when you want a layer image to land exactly where a mask says it should - and then blend in the way Photoshop would. Think: you have a portrait, you have a mask of the area where a logo or a second image should sit, and you want that layer scaled to fit the spot, positioned on it, and merged with screen or multiply instead of just pasted flat on top. That's the whole job, in one node.
It's a sibling of the pack's ApplyMaskToAlpha and Area Based Scale (Pixel) nodes, and it solves the problem those two only halfway cover: not just scaling a layer to match a mask's footprint, but actually compositing it onto a background.
How it works
The mechanism is the interesting part, and it's worth knowing before you use it. The layer_mask is used for position and size only - the node finds the mask's bounding box, then scales layer_image to fully cover that box while keeping the layer's own aspect ratio. That's a "cover" mode, like CSS object-fit: cover: the layer can be bigger than the box on one axis, but never smaller. The mask does not crop the layer's shape. If you were expecting the mask to cut the layer to the mask's silhouette, that's not this node - the mask just defines where and how big.
Once positioned, it blends using blend_mode - a list of 30+ Photoshop-style modes (normal, multiply, screen, overlay, color dodge, and a long tail of others) at 100% opacity. x_percent and y_percent shift the layer relative to the box's center (50 = perfectly centered, and the range goes to ±999), and scale is an extra multiplier on top of the auto-fit (1.0 = exactly covering the box). transform_method picks the resampling - lanczos is the default and generally the right answer.
The inputs that matter
- background_image - the canvas.
- layer_image - what gets scaled and composited.
- layer_mask - defines where (bounding box) and how big.
- blend_mode - the flavor of blend.
normalif you just want placement,multiply/screenif you're doing light or shadow work.
Output is a single image.
Install
Part of ComfyUI-WBLESS, no extra dependencies:
cd ComfyUI/custom_nodes
git clone https://github.com/LaoMaoBoss/ComfyUI-WBLESS
restart ComfyUI. Or search "ComfyUI-WBLESS" in ComfyUI Manager.
Troubleshooting
Two things bite people. First, the mask-shape misconception above - if your blended layer has hard rectangular edges, that's expected behavior, not a bug; apply the mask as alpha separately if you want the silhouette (see ApplyMaskToAlpha). Second, the layer can get clipped at the canvas edge when the mask's box is near the border, because cover-scaling makes the layer larger than the box. Drop scale below 1.0 to pull it back, and nudge x_percent/y_percent to keep the part you care about inside the frame. For the record, blend_mode does exactly what Photoshop's same-named modes do, so if you know what soft light does to a texture, you know what this node does to your layer.
Inputs (8)
| Name | Type | Default | Description |
|---|---|---|---|
| background_image | IMAGE | — | |
| layer_image | IMAGE | — | |
| layer_mask | MASK | — | |
| blend_mode | COMBO | 30 options: normal, dissolve, darken, multiply, color burn, linear burn, +24 | |
| x_percent | FLOAT | 50.00-999–999 | — |
| y_percent | FLOAT | 50.00-999–999 | — |
| scale | FLOAT | 1.000.01–100 | — |
| transform_method | COMBO | 6 options: lanczos, bicubic, hamming, bilinear, box, nearest |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |