ComfyUI Node
TS Remove Background
Remove the background with BiRefNet and return the cutout together with its mask.
TS Remove Background
- image
- background_color
- IMAGE
- MASK
- MASK_IMAGE
◄enabletrue►
◄modelBiRefNet-HR-matting►
◄use_custom_resolutionfalse►
◄process_resolution1024►
◄mask_blur0►
◄mask_offset0►
◄invert_outputfalse►
◄backgroundAlpha►
◄precisionauto►
◄temporal_smoothmedian3►
◄ema_alpha0.50►
CategoryTS/Image/Cutout
Inputs (13)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | Input image to be processed for background removal. | |
| enable | BOOLEAN | true | Enable or disable the background removal process. If disabled, the original image will be passed through. |
| model | COMBO | BiRefNet-HR-matting | Select the BiRefNet model variant to use. |
| use_custom_resolutionopt | BOOLEAN | false | Enable to use a custom resolution specified below. If disabled, the model's default resolution will be used. |
| process_resolutionopt | INT | 1024256–4096 | The resolution for processing the image. It will be adjusted to the nearest multiple of 64. |
| mask_bluropt | INT | 00–64 | Specify the amount of blur to apply to the mask edges (0 for no blur, higher values for more blur). |
| mask_offsetopt | INT | 0-20–20 | Adjust the mask boundary (positive values expand the mask, negative values shrink it). |
| invert_outputopt | BOOLEAN | false | Enable to invert both the image and mask output (useful for certain effects). |
| backgroundopt | COMBO | Alpha | Choose background type: Alpha (transparent) or Color (custom background color). |
| background_coloropt | COLOR | #ffffff | Background color when 'background' is set to 'Color'. COLOR widget supports precise eyedropper picking. |
| precisionopt | COMBO | auto | Inference precision on CUDA. 'auto' picks bf16 on Ampere+ (more numerically robust) and fp16 elsewhere. Force 'fp32' for diagnostics. CPU always runs fp32. |
| temporal_smoothopt | COMBO | median3 | Smooth alpha across frames to reduce 'boiling' edges in video. 'median3' (default) kills random 1-frame flicker; 'median5' is stronger (2-frame lag at clip boundaries); 'ema_causal' is causal averaging (no lag, can blur fast motion); 'off' disables. No-op for single images. Adds ~N*H*W*4 bytes RAM during the pass. |
| ema_alphaopt | FLOAT | 0.500–0.99 | Strength of the causal EMA when temporal_smooth = 'ema_causal'. Higher = more smoothing (more lag for moving objects); lower = closer to the raw per-frame alpha. |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |
| MASK | MASK | — |
| MASK_IMAGE | IMAGE | — |