The ComfyUI MatAnyone workflow integrates the powerful MatAnyone AI video matting model into the ComfyUI environment. Developed to remove video backgrounds using just one initial mask frame, MatAnyone provides precise, consistent, and high-quality alpha matte extraction across entire videos. This workflow significantly simplifies the traditional frame-by-frame masking process, delivering remarkable stability and clarity in subject isolation.
Example Setup for MatAnyone:
Load Video
node, upload your source video.Video Combine
node.NOTE:
By default, MatAnyone automatically generates the initial mask using the RemBG Session node. If you prefer using your own mask, simply replace this node with the"Load Image (as Mask)"
node.
RemBG Session Node:
Generates an initial high-quality mask using the RemBG model (isnet-general-use
) to simplify the mask extraction process.
MatAnyone Video Kytra Node:
Applies single-mask background removal to videos.
warmup_frames
: Number of initial frames for model initialization.erode_kernel
: Erosion kernel size to refine alpha matte edges.dilate_kernel
: Dilation kernel size to adjust boundary smoothing.bg_red
, bg_green
, bg_blue
: RGB values for replacement background color.When uploading your mask using the "Load Image (as Mask)"
node, select the appropriate channel according to your mask type to ensure accurate results. Incorrect selection can cause unexpected visual artifacts.
For additional details and technical references:
This workflow is powered by the MatAnyone model developed by Peiqing Yang, Shangchen Zhou, Jixin Zhao, Qingyi Tao, and Chen Change Loy from Nanyang Technological University and SenseTime Research. The ComfyUI MatAnyone integration is provided by KytraScript, enabling efficient single-frame mask-based background removal. Full credit goes to the original authors for their pioneering work.
RunComfy is the premier ComfyUI platform, offering ComfyUI online environment and services, along with ComfyUI workflows featuring stunning visuals. RunComfy also provides AI Playground, enabling artists to harness the latest AI tools to create incredible art.