Image BW Matte
A cheap automatic cutout matte when you don't have a matting model
- image
- mask
Not every cutout needs a background-removal model. If your subject is sitting on a plain white (or black) backdrop - a product shot, a scan, a clean line drawing - Image BW Matte will extract a usable alpha mask with a handful of sliders and zero model downloads. It's the pack author's simplified matte node: a fixed "auto + soft" pipeline that picks the best source signal, stretches its contrast, and lets you nudge the result.
It's from ComfyUI 1hewNodes (solo dev 1hew, bilingual README, active development). This is the "don't make me load a 200MB RMBG model for this" option.
How it works
The node figures out what to turn into a mask by itself, in order:
- If the image has an alpha channel with real signal, it uses that (extracting alpha from a transparent file is free).
- Otherwise, if the image borders are a uniform color (a plain backdrop), it computes per-pixel distance from that background color - the classic "difference matte."
- Otherwise it falls back to luminance (max of RGB channels).
Then it applies an auto-levels stretch: it samples the 0.5th and 99.5th percentiles as black/white points and remaps everything between, so a slightly-off-white background snaps toward black instead of becoming a muddy gray. That's the "soft" part of the fixed pipeline. Finally gamma reweights the midtones, shrink_radius erodes the matte inward (chops halo), and blur_radius feathers it. Output is a single MASK - not an image, so wire it to anything that consumes masks (composite, crop, conditioning).
The inputs that matter
- image - the source. Plain backgrounds work best; busy scenes fall back to luminance and usually need a real matting model instead.
- gamma - midtone curve, 0.1–5, default 1. Lower it to reclaim more subject at the edges.
- shrink_radius - inward erosion to kill white/black fringes (default 0, up to 128).
- blur_radius - feather the edge (default 0, up to 32).
That's the entire interface - deliberately minimal. The deeper version of this concept in the pack (Image Mask Blend with feathering and edge strategies) exists if you need more control.
Installing it
ComfyUI Manager → search "1hew" / "ComfyUI 1hewNodes" → install → restart. Manual:
cd ComfyUI/custom_nodes
git clone https://github.com/1hew/ComfyUI-1hewNodes
No model files - that's the whole appeal. The pack's requirements are heavy overall (opencv, scikit-image, ultralytics, rembg for other nodes), so first install is slow, but this node runs on numpy + Pillow alone. Needs a current ComfyUI (modern node API).
Where people get burned
- Busy backgrounds → you get the luminance fallback, which is basically a brightness matte and will look wrong. Use a real background-removal node (the pack has Detect Remove BG) for those.
- Gray fringe after masking - the background wasn't flat enough for the auto threshold. Raise the levels by cranking gamma, or shrink the matte a couple pixels.
- The result is a mask, not a cutout image - if you expected an RGBA out, composite the mask onto the original with a composite node. This node intentionally only hands you the matte.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| gamma | FLOAT | 1.000.1–5 | — |
| shrink_radius | INT | 00–128 | — |
| blur_radius | FLOAT | 0.00–32 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| mask | MASK | — |