FL Apply Mask
Punch a mask into an image's alpha channel
- image
- mask
- IMAGE
There are two different things people mean by "apply a mask" in ComfyUI. One is masking-as-conditioning - telling a sampler which region to touch during inpainting. The other is masking-as-compositing - actually cutting the mask into the image's transparency so downstream tools (a save node, a compositor, a video editor) see real alpha. FL_ApplyMask is the second kind: a small, focused node that turns a MASK into an image's actual alpha channel.
How it works
It takes your image and mask and writes the mask into the alpha channel - the README is specific that it's "adding or modifying" the alpha, so if the image already had an alpha channel, this overwrites it with the new mask rather than blending the two. If image and mask don't match in resolution, it interpolates automatically instead of erroring, which is more forgiving than some core ComfyUI masking paths that expect exact dimension matches.
The inputs and outputs that matter
Required: image, mask, and crop_to_mask (boolean, default false). With crop_to_mask off, you get back the full original canvas with the new alpha channel baked in - transparent where the mask is 0, opaque where it's 1. Turn it on and the node also crops the output down to the mask's actual content bounding box, so you're not carrying around a huge transparent canvas around a small masked subject.
Output: a single IMAGE - note it's a single output socket, so this node is meant to sit inline in a chain, not branch.
How to install it
ComfyUI Manager: search ComfyUI_Fill-Nodes, install, restart. Or by hand:
cd ComfyUI/custom_nodes
git clone https://github.com/filliptm/ComfyUI_Fill-Nodes
then restart. Pure torch/PIL math - no dependencies beyond what ComfyUI already ships with, no models to download.
Common issues & troubleshooting
Alpha channel doesn't show up anywhere. A lot of downstream nodes silently drop alpha - the default ComfyUI Save Image node keeps it if you're saving PNG, but plenty of preview widgets, video-export nodes, and JPG saves strip it. If the transparency you set here isn't visible later in the pipeline, check that the node actually preserving alpha is the one you're using to view or export the result.
Existing transparency disappears. Since this node modifies the alpha channel rather than merging with an existing one, running it on an image that already had meaningful transparency (say, from a prior cutout step) replaces that transparency with your new mask. If you need to combine two masks instead of replacing one with another, combine them upstream (with a mask math node) before this one, not after.
Batch processing works, but check your mask's batch dimension matches. The node supports batched images and masks, but if your mask batch is a single frame and your image batch has many, confirm the interpolation/broadcast behavior gives you what you expect rather than assuming it - a quick preview on a small batch first is cheap insurance.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| mask | MASK | — | |
| crop_to_mask | BOOLEAN | false | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |