Nodes/ComfyUI-AusBoss/Mask by Name πŸ†Ž
ComfyUI Node

Mask by Name πŸ†Ž

Type what to find in a picture, like "the dog" or "the jacket", and get its mask. Nothing to paint. The node shows what it found, tinted on the picture. When it finds nothing it stops the run with a plain message, so nothing after it runs on an empty mask (or it can pass an empty mask on: a setting). Find runs only this node, to check the mask first. It uses ComfyUI's own SAM 3: wire model and clip from a Load Checkpoint that loads the SAM 3 file. It also returns the thing cut out on a see-through background.

By ausbossΒ·Created 3 months agoΒ·Updated about 5 hours agoΒ· 46
Mask by Name πŸ†Ž
  • image
  • model
  • clip
  • mask
  • cut_out
  • found
β—„namethe personβ–Ί
β—„severalall of themβ–Ί
β—„grow0β–Ί
β—„soften0.0β–Ί
β—„if_nothingstop the runβ–Ί
β—„previewtrueβ–Ί
β—„threshold0.70β–Ί
β—„fill_holesfalseβ–Ί
β—„free_vramfalseβ–Ί
CategoryπŸ†Ž AusBoss/Mask

Inputs (12)

NameTypeDefaultDescription
imageIMAGEThe picture to search.
modelMODELSAM 3: MODEL from a Load Checkpoint that loads the SAM 3 file.
clipCLIPSAM 3's text reader: CLIP from the same Load Checkpoint.
nameSTRINGthe personWhat to find, in a few plain words: "the dog", "the red jacket". Several things: put a comma between them.
severalCOMBOall of themWhen more than one thing matches: mask all of them, or only the biggest.
growINT00–512Pixels to grow the mask past the thing's edge. 0 keeps the exact outline.
softenFLOAT0.00–100Soften the mask's edge by this many pixels. 0 keeps a hard edge.
if_nothingCOMBOstop the runWhen nothing matches the name. Stop the run: the workflow stops here with a message, and nothing after this node runs. Empty mask: the run goes on with a mask of nothing.
previewoptBOOLEANtrueShow what was found on this node. Off skips writing the preview file to ComfyUI's temp folder.
thresholdoptFLOAT0.700.05–0.95How sure SAM 3 must be that something matches the name. Lower it when a small thing is missed. Raise it when it picks up something that is not the thing.
fill_holesoptBOOLEANfalseFill gaps that lie fully inside the mask, like the spots SAM 3 leaves in hair or cloth. On gives a solid shape.
free_vramoptBOOLEANfalseTakes SAM 3 out of the graphics card's memory right after the search. Turn it on in a workflow that loads a big model after this node; off keeps the next search a little faster.

Outputs (3)

NameTypeDescription
maskMASKWhite where the thing is. One mask per picture.
cut_outIMAGEThe picture with everything but the thing see-through (RGBA).
foundINTHow many things matched the name in the first picture.