Nodes/ComfyUI_LayerStyle_Advance/LayerMask: Transparent Background Ultra(Advance)
ComfyUI Node Runs on cloud

LayerMask: Transparent Background Ultra(Advance)

Transparent Background Ultra — the fast alternative to BiRefNet

By chflame163·Created 2 years ago·Updated 4 months ago· 696
LayerMask: Transparent Background Ultra(Advance)
  • image
  • image
  • mask
model
detail_method
detail_erode6
detail_dilate6
black_point0.01
white_point0.99
process_detailtrue
device
max_megapixels2.0

Background removal in this pack isn't one node - it's a family, and each member trades off differently between speed and edge quality. This one wraps the transparent-background model, and the pitch (per the README) is specifically better recognition speed than the alternatives, while still getting the ultra-fine edge treatment the rest of the pack applies. If BiRefNet Ultra is your default and it's too slow for a batch job, this is the node to try before dropping down to something cruder.

There's exactly one model-specific choice, model, which selects between whatever variants of the transparent-background model you've got installed. Everything else is the same edge-refinement stack shared across the pack's masking nodes: detail_method picks the refinement technique - VITMatte for the best hair/fur edges (at real memory cost on big images), VITMatte(local) to reuse an already-downloaded VITMatte model instead of re-fetching it, PyMatting and GuidedFilter as lighter, faster alternatives. detail_erode and detail_dilate shrink or grow the mask boundary inward or outward from the edge; black_point and white_point are the sampling thresholds that control how the edge cleanup treats near-black and near-white regions. process_detail is your master switch - turn it off and you skip the whole refinement pass for a much faster, rougher mask, which is exactly the trade-off this node exists to make easy. device picks CUDA or CPU for the refinement stage, and max_megapixels caps how large an image gets processed at full detail before VITMatte becomes the bottleneck. Outputs are image and mask.

Install through ComfyUI Manager (search "ComfyUI Layer Style Advance") or git clone https://github.com/chflame163/ComfyUI_LayerStyle_Advance into custom_nodes/, restart, run the requirements installer. The model files go in ComfyUI/models/transparent-background - grab the full folder from the author's Google Drive or Baidu links (also bundled in the combined HuggingFace repo). If you're using VITMatte for edge detail, that's a separate model that needs to land in ComfyUI/models/vitmatte.

There isn't a lot of unique breakage here beyond what the rest of the pack's matting nodes hit - a cv2.ximgproc guidedFilter import error means a bad opencv-contrib-python install (repair_dependency.bat fixes it automatically rather than you chasing individual package versions), and a VitMatteImageProcessor import failure means transformers needs updating. The practical thing worth knowing is when to actually reach for this node instead of BiRefNet: if you're processing a large batch and speed matters more than squeezing out the last bit of edge quality, this is the one to try first, since it's explicitly built to be the faster of the two - but on genuinely hard cases (real hair, real transparency) it's still worth comparing a few images against BiRefNet before standardizing on either, because nothing in this space wins outright on every image.

Where this node earns its keep specifically: iterating on a workflow where you're re-running the mask dozens of times while you tune something else downstream. Paying BiRefNet's cost on every single test run adds up, and dropping in Transparent Background Ultra for the iteration loop - then swapping back to BiRefNet for the final pass once everything else is locked in - is a reasonable way to get fast feedback without giving up quality on the output that actually matters. The two nodes share the same image-in, image/mask-out shape, so swapping between them in a graph is a one-node change, not a rewire.

Category😺dzNodes/LayerMask

Inputs (10)

NameTypeDefaultDescription
imageIMAGE
modelCOMBO0 options:
detail_methodCOMBO5 options: VITMatte, VITMatte(local), vitmatte-base-composition-1k, PyMatting, GuidedFilter
detail_erodeINT61–255
detail_dilateINT61–255
black_pointFLOAT0.010.01–0.98
white_pointFLOAT0.990.02–0.99
process_detailBOOLEANtrue
deviceCOMBO2 options: cuda, cpu
max_megapixelsFLOAT2.01–999

Outputs (2)

NameTypeDescription
imageIMAGE
maskMASK