Nodes/ComfyUI Essentials/πŸ”§ Apply CLIPSeg
ComfyUI Node Runs on cloud

πŸ”§ Apply CLIPSeg

Apply CLIPSeg β€” make a mask by just describing what you want masked

By cubiqΒ·Created 3 years agoΒ·Updated about a year agoΒ· 1,152
πŸ”§ Apply CLIPSeg
  • clip_seg
  • image
  • MASK
β—„promptβ–Ί
β—„threshold0.40β–Ί
β—„smooth9β–Ί
β—„dilate0β–Ί
β—„blur0β–Ί

This is the "just tell it what to mask" node. Instead of painting a mask by hand or wiring up a detection model, you type a word - "hair", "shirt", "sky", "the dog" - and CLIPSeg produces a mask of that thing in your image. It's text-prompted segmentation, and it's genuinely one of the faster ways to get a rough mask when you don't have a dedicated detector for whatever you're targeting.

What it does

Apply CLIPSeg runs the CLIPSeg model over your image using a text prompt and returns a MASK. The inputs:

  • clip_seg - a CLIP_SEG input. This is the loaded CLIPSeg model, and it comes from a separate loader node in the Essentials pack, not from Apply CLIPSeg itself. You load the model once and feed it in here.
  • image - the IMAGE you want to segment.
  • prompt - the text describing what to mask. Short and concrete works best: "face", "background", "red car".
  • threshold (0–1, default 0.4) - how confident a pixel has to be to make it into the mask. Lower catches more (and more false positives); higher is stricter.
  • smooth (default 9) - smooths the mask edges.
  • dilate (βˆ’32 to 32, default 0) - grows (positive) or shrinks (negative) the mask.
  • blur (default 0) - softens the edge into a gradient.

Output is a single MASK. Notice that threshold/smooth/dilate/blur mean Apply CLIPSeg already does a decent amount of the mask cleanup that you'd otherwise send through Mask Fix.

Where it fits

CLIPSeg's whole appeal is coverage without setup. A face detector masks faces; a person segmenter masks people; but when you want to mask "the curtains" or "the puddle," there's rarely a purpose-built model - and CLIPSeg will take a swing at it from the text alone. That makes it a great first-pass masking tool for inpainting, background swaps, and targeted color/effect edits where you don't want to hand-paint. It's approximate, not surgical, but for "give me a rough mask of X right now," it's hard to beat.

Installing it

Part of ComfyUI Essentials by cubiq - Matteo Spinelli, the developer behind the community-standard ComfyUI_IPAdapter_plus:

  • ComfyUI Manager: search "ComfyUI Essentials" β†’ Install β†’ restart.
  • Manual: cd ComfyUI/custom_nodes && git clone https://github.com/cubiq/ComfyUI_essentials, install requirements.txt, restart.

The model download: Apply CLIPSeg needs the CLIPSeg weights, which the companion loader node fetches from Hugging Face the first time you run it. That means the first run needs internet and will pause while it downloads - and on a locked-down or offline box, that download is exactly where this node fails. If nothing happens on first use, check your ComfyUI console; it's probably pulling the model.

Gotchas

You can't use Apply CLIPSeg alone - it requires the CLIP_SEG input from the pack's CLIPSeg loader node. Add both: loader β†’ Apply CLIPSeg. Forgetting the loader is the number-one confusion here.

Prompts matter more than you'd expect. CLIPSeg responds to how you phrase things; a vague prompt gives a vague mask. Try a couple of wordings, and tune threshold - if the mask grabs too much, raise it; too little, lower it. Then clean the result with dilate/blur (or a downstream Mask Fix) before you inpaint.

Manage your expectations on precision. CLIPSeg is fast and flexible but soft-edged and approximate - for pixel-tight masks on a well-defined class (faces, hands), a dedicated detector will beat it. Use CLIPSeg for the things nothing else can mask easily.

Pack note: cubiq set Essentials to maintenance-only in April 2025. It still works, but if it errors after a big ComfyUI update, roll ComfyUI back or patch it - no upstream fixes. A red "missing node" box means the pack didn't load; check the startup log (often a missing Python dependency for this one) and reinstall via Manager.

Categoryessentials/segmentation

Inputs (7)

NameTypeDefaultDescription
clip_segCLIP_SEGβ€”
imageIMAGEβ€”
promptSTRINGβ€”
thresholdFLOAT0.400–1β€”
smoothINT90–32β€”
dilateINT0-32–32β€”
blurINT00–64β€”

Outputs (1)

NameTypeDescription
MASKMASKβ€”