Nodes/was-node-suite-comfyui/CLIPSeg Batch Masking
ComfyUI Node Runs on cloud

CLIPSeg Batch Masking

Mask a whole folder of images with one text prompt

By WASasquatch·Created 3 years ago·Updated about 13 hours ago· 1,840
CLIPSeg Batch Masking
  • image_a
  • image_b
  • clipseg_model
  • image_c
  • image_d
  • image_e
  • image_f
  • image_g
  • image_h
  • image_i
  • image_j
  • image_k
  • image_l
  • image_m
  • image_n
  • image_o
  • image_p
  • image_q
  • image_r
  • image_s
  • image_t
  • image_u
  • image_v
  • image_w
  • image_x
  • IMAGES_BATCH
  • MASKS_BATCH
  • MASK_IMAGES_BATCH
  • count
text_a
text_b
text_c
text_d
text_e
text_f
text_g
text_h
text_i
text_j
text_k
text_l
text_m
text_n
text_o
text_p
text_q
text_r
text_s
text_t
text_u
text_v
text_w
text_x

CLIPSeg Masking (the singular one) does one image at a time: image in, text prompt in, mask out. WAS's README describes this batch version plainly - "Create a batch image (from image inputs) and batch mask with CLIPSeg" - which is exactly the multiplied version of that same job. Feed it multiple images, give it one text prompt, and get back a batch of masks, each one generated by applying the same CLIPSeg model to the same description across every image in the set.

The obvious use case is anything that starts with a folder rather than a single file. Pair this with WAS's own Load Batch Images node - which steps through a directory using a glob pattern - and you've got a pipeline that walks a whole folder of, say, product photos or portraits and masks "the subject" (or "the background," or whatever your prompt says) on every single one, without wiring up a separate CLIPSeg node per image or looping manually. That's the entire pitch: same zero-shot, text-driven segmentation as the single-image node, just amortized across a batch so you're not repeating the same wiring N times.

Worth remembering what CLIPSeg actually is under the hood, since it explains both the power and the limits here: it's a model that jointly embeds an image and a short text description and predicts which pixels the description points at, with no fixed class list and no training required for your specific subject. That flexibility is why it's worth batching - you're not constrained to whatever a pre-trained detector recognizes. But it also means the same prompt has to work reasonably well across every image in your batch; if your folder has wildly inconsistent framing, lighting, or subject matter, a single fixed prompt may land cleanly on some images and produce a noisy, low-confidence mask on others. This isn't a defect specific to WAS's implementation, it's just the nature of running one prompt against a mixed batch - check a few outputs from the middle of your set, not just the first one, before trusting the whole run.

Inputs are, per the README's own description, multiple images (or an image batch) plus a text prompt; outputs are a batch IMAGE and a batch MASK, ready to feed into a batch inpainting or batch compositing pipeline downstream.

Installing it: ComfyUI Manager, search "WAS Node Suite," install, restart. Manual: cd ComfyUI/custom_nodes && git clone https://github.com/WASasquatch/was-node-suite-comfyui, then pip install -r requirements.txt (portable: python_embeded\python.exe -s -m pip install -r requirements.txt; manual/venv: activate the venv first), restart ComfyUI. Like WAS's other model-backed nodes (BLIP being the documented example), expect the CLIPSeg checkpoint to download itself from Hugging Face the first time you actually run a CLIPSeg node rather than at install time.

Where it bites: running CLIPSeg across a batch is heavier than running it once, so expect this node to take noticeably longer and use more memory than the single-image version on the same hardware - that's expected behavior, not a bug. Beyond that, the standing caveat for this whole pack applies: WAS Node Suite has been unmaintained since December 2023 (its README says "Retired"), and the community's recurring complaint is the entire suite failing to import after a ComfyUI update rather than individual nodes breaking on their own - check your console for a whole-suite import error before troubleshooting this node specifically.

CategoryWAS Suite/Image/Masking

Inputs (49)

NameTypeDefaultDescription
image_aIMAGEFirst image. Its size decides the size of every output, and the other images have to match it. A batch here is masked image by image, all against text_a.
image_bIMAGESecond image. Masked against text_b, and a batch here is masked image by image against it.
text_aSTRINGWhat to select in image_a, in plain words: 'the sky', 'a red car'. Short noun phrases work best. This box and text_b are always used, empty or not.
text_bSTRINGWhat to select in image_b.
clipseg_modelCLIPSEG_MODELThe segmentation model, from CLIPSeg Model Loader. One loader can feed several nodes so the weights are built once.
image_coptIMAGEThird image, if there is one. Same size as image_a.
image_doptIMAGEFourth image, if there is one. Same size as image_a.
image_eoptIMAGEFifth image, if there is one. Same size as image_a.
image_foptIMAGESixth image, if there is one. Same size as image_a.
image_goptIMAGEPicture 7, segmented by text_g. Unconnected is skipped.
image_hoptIMAGEPicture 8, segmented by text_h. Unconnected is skipped.
image_ioptIMAGEPicture 9, segmented by text_i. Unconnected is skipped.
image_joptIMAGEPicture 10, segmented by text_j. Unconnected is skipped.
image_koptIMAGEPicture 11, segmented by text_k. Unconnected is skipped.
image_loptIMAGEPicture 12, segmented by text_l. Unconnected is skipped.
image_moptIMAGEPicture 13, segmented by text_m. Unconnected is skipped.
image_noptIMAGEPicture 14, segmented by text_n. Unconnected is skipped.
image_ooptIMAGEPicture 15, segmented by text_o. Unconnected is skipped.
image_poptIMAGEPicture 16, segmented by text_p. Unconnected is skipped.
image_qoptIMAGEPicture 17, segmented by text_q. Unconnected is skipped.
image_roptIMAGEPicture 18, segmented by text_r. Unconnected is skipped.
image_soptIMAGEPicture 19, segmented by text_s. Unconnected is skipped.
image_toptIMAGEPicture 20, segmented by text_t. Unconnected is skipped.
image_uoptIMAGEPicture 21, segmented by text_u. Unconnected is skipped.
image_voptIMAGEPicture 22, segmented by text_v. Unconnected is skipped.
image_woptIMAGEPicture 23, segmented by text_w. Unconnected is skipped.
image_xoptIMAGEPicture 24, segmented by text_x. Unconnected is skipped.
text_coptSTRINGWhat to select in image_c. An empty box is left out of the list.
text_doptSTRINGWhat to select in image_d. An empty box is left out of the list.
text_eoptSTRINGWhat to select in image_e. An empty box is left out of the list.
text_foptSTRINGWhat to select in image_f. An empty box is left out of the list.
text_goptSTRINGWhat to find in image_g. Empty is skipped.
text_hoptSTRINGWhat to find in image_h. Empty is skipped.
text_ioptSTRINGWhat to find in image_i. Empty is skipped.
text_joptSTRINGWhat to find in image_j. Empty is skipped.
text_koptSTRINGWhat to find in image_k. Empty is skipped.
text_loptSTRINGWhat to find in image_l. Empty is skipped.
text_moptSTRINGWhat to find in image_m. Empty is skipped.
text_noptSTRINGWhat to find in image_n. Empty is skipped.
text_ooptSTRINGWhat to find in image_o. Empty is skipped.
text_poptSTRINGWhat to find in image_p. Empty is skipped.
text_qoptSTRINGWhat to find in image_q. Empty is skipped.
text_roptSTRINGWhat to find in image_r. Empty is skipped.
text_soptSTRINGWhat to find in image_s. Empty is skipped.
text_toptSTRINGWhat to find in image_t. Empty is skipped.
text_uoptSTRINGWhat to find in image_u. Empty is skipped.
text_voptSTRINGWhat to find in image_v. Empty is skipped.
text_woptSTRINGWhat to find in image_w. Empty is skipped.
text_xoptSTRINGWhat to find in image_x. Empty is skipped.

Outputs (4)

NameTypeDescription
IMAGES_BATCHIMAGEEvery image that was given, as one batch in input order, so the masks line up with the pictures they came from.
MASKS_BATCHMASKOne mask per image, brighter where the phrase matched, for an inpainting or compositing node.
MASK_IMAGES_BATCHIMAGEThe same masks as black and white images, to preview or to feed a node that takes an image rather than a mask.
countINTHow many frames each batch holds, which is the total across the slots rather than the number of slots.