image-apply-alpha — Masking AI Model
Apply Mask as Alpha turns an image and a black-and-white mask into a transparent cutout: white keeps, black becomes transparent, grey is partly see-through. Image Multiply can only paint the dropped area black; this leaves it clear, so the result drops onto any background. If the image is already a cutout (BiRefNet), the two are combined, so BiRefNet's soft hair edge and a SAM mask that isolates one person work together. A light feather softens the stair-stepped edge of segmentation masks. Output is always PNG. CPU, instant.
Details
- CategoryMasking
- Year-1
- License
Inputs & Outputs
- ImageInputimage
Image to cut out (an existing alpha is kept and combined)
- MaskInputimage
Mask: white = keep, black = transparent
- ImageOutputimage
Transparent cutout (PNG)
Parameters
- featherintegerdefault 1range 0–32
Soften the mask edge (px)
Gaussian blur radius applied to the mask before it becomes alpha, in pixels of the image. Default 1 smooths the stair-stepped edge a segmentation mask leaves; 0 keeps the mask exactly as given; 3-6 gives a visibly soft edge. Applied to the mask only, so an alpha the image already has (BiRefNet) keeps its own edge.
- invertbooleandefault false
Invert the mask (keep the black area)
When true, black keeps and white becomes transparent — e.g. to cut the subject OUT of the image and keep the background. Default false.
- fitstringdefault coveroptions: cover, contain, stretchadvanced
How to fit a differently-sized mask to the image.
When the mask's resolution differs from the image's, how the mask is fit to the image (the output is always the image's size): 'cover' (default) scales to fill and center-crops, 'contain' scales to fit and pads with transparent, 'stretch' resizes to the exact size (use it when the mask came from a resized copy of a different aspect).
Tags
Alternatives in Image Masking
- Image Masker by Class
Build a B&W mask from segmentation/detection by class name.
- Image Masker by Coord
Build a B&W mask from explicit bbox coordinates.
- Image Masker by Region
Build a B&W mask from line-separated polygons or bounding boxes.
- Manual Image Masker
Hand-draw a B&W mask with brush tools.
- Mask Grow / Shrink
Grow or shrink a mask by N pixels. Instant.
- Object Picker
Interactive — click segmented objects to build a mask.