CLIPSeg Batch Masking
Mask a whole folder of images with one text prompt
- 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
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.
Inputs (49)
| Name | Type | Default | Description |
|---|---|---|---|
| image_a | IMAGE | First 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_b | IMAGE | Second image. Masked against text_b, and a batch here is masked image by image against it. | |
| text_a | STRING | What 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_b | STRING | What to select in image_b. | |
| clipseg_model | CLIPSEG_MODEL | The segmentation model, from CLIPSeg Model Loader. One loader can feed several nodes so the weights are built once. | |
| image_copt | IMAGE | Third image, if there is one. Same size as image_a. | |
| image_dopt | IMAGE | Fourth image, if there is one. Same size as image_a. | |
| image_eopt | IMAGE | Fifth image, if there is one. Same size as image_a. | |
| image_fopt | IMAGE | Sixth image, if there is one. Same size as image_a. | |
| image_gopt | IMAGE | Picture 7, segmented by text_g. Unconnected is skipped. | |
| image_hopt | IMAGE | Picture 8, segmented by text_h. Unconnected is skipped. | |
| image_iopt | IMAGE | Picture 9, segmented by text_i. Unconnected is skipped. | |
| image_jopt | IMAGE | Picture 10, segmented by text_j. Unconnected is skipped. | |
| image_kopt | IMAGE | Picture 11, segmented by text_k. Unconnected is skipped. | |
| image_lopt | IMAGE | Picture 12, segmented by text_l. Unconnected is skipped. | |
| image_mopt | IMAGE | Picture 13, segmented by text_m. Unconnected is skipped. | |
| image_nopt | IMAGE | Picture 14, segmented by text_n. Unconnected is skipped. | |
| image_oopt | IMAGE | Picture 15, segmented by text_o. Unconnected is skipped. | |
| image_popt | IMAGE | Picture 16, segmented by text_p. Unconnected is skipped. | |
| image_qopt | IMAGE | Picture 17, segmented by text_q. Unconnected is skipped. | |
| image_ropt | IMAGE | Picture 18, segmented by text_r. Unconnected is skipped. | |
| image_sopt | IMAGE | Picture 19, segmented by text_s. Unconnected is skipped. | |
| image_topt | IMAGE | Picture 20, segmented by text_t. Unconnected is skipped. | |
| image_uopt | IMAGE | Picture 21, segmented by text_u. Unconnected is skipped. | |
| image_vopt | IMAGE | Picture 22, segmented by text_v. Unconnected is skipped. | |
| image_wopt | IMAGE | Picture 23, segmented by text_w. Unconnected is skipped. | |
| image_xopt | IMAGE | Picture 24, segmented by text_x. Unconnected is skipped. | |
| text_copt | STRING | What to select in image_c. An empty box is left out of the list. | |
| text_dopt | STRING | What to select in image_d. An empty box is left out of the list. | |
| text_eopt | STRING | What to select in image_e. An empty box is left out of the list. | |
| text_fopt | STRING | What to select in image_f. An empty box is left out of the list. | |
| text_gopt | STRING | What to find in image_g. Empty is skipped. | |
| text_hopt | STRING | What to find in image_h. Empty is skipped. | |
| text_iopt | STRING | What to find in image_i. Empty is skipped. | |
| text_jopt | STRING | What to find in image_j. Empty is skipped. | |
| text_kopt | STRING | What to find in image_k. Empty is skipped. | |
| text_lopt | STRING | What to find in image_l. Empty is skipped. | |
| text_mopt | STRING | What to find in image_m. Empty is skipped. | |
| text_nopt | STRING | What to find in image_n. Empty is skipped. | |
| text_oopt | STRING | What to find in image_o. Empty is skipped. | |
| text_popt | STRING | What to find in image_p. Empty is skipped. | |
| text_qopt | STRING | What to find in image_q. Empty is skipped. | |
| text_ropt | STRING | What to find in image_r. Empty is skipped. | |
| text_sopt | STRING | What to find in image_s. Empty is skipped. | |
| text_topt | STRING | What to find in image_t. Empty is skipped. | |
| text_uopt | STRING | What to find in image_u. Empty is skipped. | |
| text_vopt | STRING | What to find in image_v. Empty is skipped. | |
| text_wopt | STRING | What to find in image_w. Empty is skipped. | |
| text_xopt | STRING | What to find in image_x. Empty is skipped. |
Outputs (4)
| Name | Type | Description |
|---|---|---|
| IMAGES_BATCH | IMAGE | Every image that was given, as one batch in input order, so the masks line up with the pictures they came from. |
| MASKS_BATCH | MASK | One mask per image, brighter where the phrase matched, for an inpainting or compositing node. |
| MASK_IMAGES_BATCH | IMAGE | The same masks as black and white images, to preview or to feed a node that takes an image rather than a mask. |
| count | INT | How many frames each batch holds, which is the total across the slots rather than the number of slots. |