CivArchive
    ← All articles
    Published February 12, 2026by bemoreone807

    [Custom node] Mask Smoothing Node

    64 views0 reactions0 comments on CivitAI0 collected
    announcement

      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