ComfyUI Node

FC MaskOP

FC MaskOP — blur, erode, or dilate any mask before it wrecks your composite

By THtianhao·Created 3 years ago·Updated about a year ago· 147
FC MaskOP
  • mask
  • MASK
method
kernel16

FC MaskOP is the pack's mask-editing utility: three classic morphological operations - blur, erode, dilate - on any MASK you feed it. It's the boring, dependable cleanup node, and in a pack that generates masks from segmentation models (which are rarely perfect the first time), it earns its keep. Blur the seam before compositing, erode a mask that's creeping past the face, dilate one that's too tight.

It's dead simple, which is the point. The README describes it in one line: "operations on the mask," with the note that a bigger kernel means a stronger operation.

The inputs

  • mask (MASK, required) - the mask to transform. Wire in anything: FC FaceSegment's soft_mask, a FC FaceDetectCrop mask, or one you've drawn.
  • method - one of three choices: burl (Gaussian blur), erode (shrink the white region), dilate (grow it).
  • kernel (INT, default 16, 0–100) - the size of the operation kernel. Larger = more aggressive. 16 is already a fairly strong default; for fine control start around 4–8.

One MASK output: the transformed mask, ready to feed the next node.

The gotcha: the blur option is spelled burl

Yes, "burl" - it's a typo in the pack's code (["burl", "erode", "dilate"]), and it's what the dropdown literally shows. Don't go hunting for a "blur" option or assume your ComfyUI is broken. The blur uses a Gaussian kernel derived from the kernel size, while erode and dilate use a square structuring element of kernel × kernel.

Where it fits

Every compositing graph in this pack benefits from a pass through this node. The canonical uses:

  • Blur the seam. After FC FaceSegment or before FC ReplaceByMask, a blur softens the hard mask edge so the pasted region doesn't show a sharp cut line.
  • Erode before paste-back. FC CropToOrigin already erodes internally, but when you're hand-compositing, eroding keeps the swapped region slightly inside the target rather than bleeding over the boundary.
  • Dilate to rescue a tight mask. Segmentation masks often miss the hair fringe; a dilation grows them back out.

Install

It's part of ComfyUI-FaceChain, so: ComfyUI Manager (search "ComfyUI-FaceChain") or git clone https://github.com/THtianhao/ComfyUI-FaceChain into custom_nodes/, restart. Unlike the pack's model nodes, this one is pure OpenCV math - no downloads, no ModelScope, no per-run waiting. The pack's heavy startup dependency install still happens once, but after that this node is instant.

One more honest note: it's a utility, not a tool you'll show off, but every serious FaceChain graph ends up with one in it. The alternative is the same operations hand-rolled in a custom script - and you'd write the exact same thing.

Categoryfacechain/mask

Inputs (3)

NameTypeDefaultDescription
maskMASK
methodCOMBO3 options: burl, erode, dilate
kernelINT160–100

Outputs (1)

NameTypeDescription
MASKMASK