MonoMerge
Merge two masks by max or min — the two-line idea that saves you a node pack
- image1
- image2
- IMAGE
This is the rare node where the whole thing fits in a sentence: it takes two images and, pixel by pixel, keeps whichever is brighter (or darker). The pack README sums it up as "selects the maximum (or minimum) value between two images," and notes it's mainly used for mask composition. That's the honest pitch - MonoMerge is a mask-combining primitive, not a flashy feature.
Why is that useful? Masks in ComfyUI are images where white (255) means "include" and black (0) means "exclude." So a per-pixel max of two masks is the union - anywhere either mask is white, the result is white. A per-pixel min is the intersection - only where both are white. If you've ever tried to composite masks with blend modes or arithmetic nodes and gotten mud, this is the clean, obvious version of those two operations.
How it works
Both inputs get converted to grayscale, then it's a single numpy operation: np.maximum when target is "white", np.minimum when it's "black". No kernel, no blur, no surprises. output_format lets you keep it GRAY (handy if whatever's downstream wants single-channel) or bounce it back to RGB. That's the whole thing - which is the point. It's a one-trick node you'll wire in without thinking.
The inputs
image1/image2(IMAGE) - the two masks or images.target- "white" = take the maximum (union), "black" = take the minimum (intersection).output_format- RGB or GRAY.
Output is a single IMAGE.
When you'd actually grab it
The realistic scenario: you've got two masks for the same region from different sources - one from an edge/segmentation pass, one from a color range - and you want "either of these counts," which is the union via max. Or you're masking a face from both an eyes mask and a mouth mask and you want only the overlap, which is min. It also shines for compositing: put a subject mask and a shadow mask through the max and you get one clean mask covering both, ready to feed an inpaint or ControlNet setup.
Installing it
cd ComfyUI/custom_nodes
git clone https://github.com/bmad4ever/comfyui_bmad_nodes
restart, or grab comfyui_bmad_nodes through ComfyUI Manager. It lives in the same pack as all the CV/mask utilities, so the OpenCV requirements tag along. No models to download.
The one caveat
It merges by raw value, not by channel or alpha - so anything that isn't clean black-and-white will merge as "brighter wins," which can produce intermediate grays if your inputs have soft edges. If you feed it soft-edged masks and want a hard binary result, threshold them first (the pack's OtsuThreshold is a good one-stop for that). With clean masks, though, it just works - two wires in, one wire out.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| image1 | IMAGE | — | |
| image2 | IMAGE | — | |
| target | COMBO | white | 2 options: white, black |
| output_format | COMBO | RGB | 2 options: RGB, GRAY |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |