GetMaskByBen
Image in, mask out, nothing else
- model
- images
- mask
If RembgByBen is the whole meal, GetMaskByBen is just the ingredient. Model and images in, a single mask out - no foreground color estimation, no alpha compositing, no fringes. You want this node when you need the segmentation mask for something else: regional inpainting, feeding a compositing node, or chaining into the pack's own BlurFusionForegroundEstimationForBen.
Mechanism, from the source: your image gets preprocessed to width×height (default 1024×1024) with the chosen upscale_method, run through BEN, and the resulting mask is resized back to your original image size. That's the part to internalize: width and height don't change your output resolution - the tooltip says so explicitly - they're the resolution the model actually sees.
The settings that matter:
width/height(1024): the model's working resolution. A sane default for most inputs. Lower it to ~512 for speed on a low-res image, and don't bother cranking it up - BEN downscales internally on big inputs anyway, so feeding it 4K mostly just costs time.upscale_method: bilinear (default), nearest / nearest-exact for hard edges, bicubic if you want the mask slightly smoothed. Bilinear is the safe pick.mask_threshold(0): the one worth experimenting with. At 0 it's off. Set it above 0 and any pixel below the threshold gets zeroed, which scrubs faint noise floating around the subject. The cost is it also thins soft edges, so start around 0.02 and check the preview.
Output: just mask (MASK), matching your input batch. Wire it into an inpainting mask input, into compositing, or into BlurFusionForegroundEstimationForBen to recover the foreground color.
Everything about the model, the install, and the models/rembg/ben/ folder is shared with the rest of the pack - see RembgByBen for the full walkthrough. The quick version: clone, pip install -r requirements.txt, restart, and make sure BEN_Base.pth (or a file whose name contains BEN2_Base, for the v2 architecture) is sitting in ComfyUI/models/rembg/ben/.
Honest take: most people never touch this node, because RembgByBen wraps it with good defaults. You're here because you want the mask as a first-class output - and for that, it's the cleanest node in the pack.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| model | BEN | — | |
| images | IMAGE | — | |
| width | INT | 10240–16384 | The width of the pre-processing image, does not affect the final output image size |
| height | INT | 10240–16384 | The height of the pre-processing image, does not affect the final output image size |
| upscale_method | COMBO | bilinear | Interpolation method for pre-processing image and post-processing mask |
| mask_threshold | FLOAT | 0.0000–1 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| mask | MASK | — |