Sign In

[Custom node] Mask Smoothing Node

0

Feb 12, 2026

(Updated: 19 days ago)

announcement
[Custom node] Mask Smoothing Node

  Mask Fourier Smoothing — ComfyUI Custom Node                                               

                                                                                               

  Smooth out jagged mask edges using Fourier Descriptor algorithm — a classic signal processing

   technique applied to contour shapes.                                                        

                                                                                               

  What it does                                                                                 

                                                                                               

  This node takes a mask as input, extracts its contour, applies FFT-based low-pass filtering

  in the frequency domain, and reconstructs a clean, smooth mask. No blur, no dilation — just

  mathematically smooth edges.

  How it works

  The contour points are encoded as complex numbers (x + jy) and transformed via FFT. By

  keeping only the low-frequency Fourier components and discarding the high-frequency ones

  (which represent sharp corners and noise), the inverse FFT reconstructs a naturally smoothed

  contour.

  Parameters

  - num_descriptors (default: 32, range: 4–512) — Controls how many frequency components are

  kept. Lower = smoother. Higher = closer to original.

  Use cases

  - Cleaning up hand-painted masks from inpainting workflows

  - Smoothing segmentation masks before feeding into ControlNet

  - Removing jagged artifacts from any binary mask

  Installation

  custom_nodes/

  └── ComfyUI_MaskSmoothing/

  GitHub: https://github.com/bemoregt/ComfyUI_MaskSmoothing

0