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

Mask by Touch πŸ†Ž

Click a thing on the picture, or paint over it, and get its mask. No name to type and no MaskEditor. Moving over the picture lights up what a click would take. A painted stroke takes the thing under it, or exactly the paint. What is lit is what the mask will be. When nothing is picked 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). 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 picked area cut out on a see-through background, and the names of what you picked as text.

By ausbossΒ·Created 3 months agoΒ·Updated about 5 hours agoΒ· 46
Mask by Touch πŸ†Ž
  • image
  • model
  • clip
  • mask
  • cut_out
  • names
β—„touchesβ–Ί
β—„grow0β–Ί
β—„soften0.0β–Ί
β—„smooth0β–Ί
β—„fill_holestrueβ–Ί
β—„if_nothingstop the runβ–Ί
β—„free_vramfalseβ–Ί
β—„invertfalseβ–Ί
β—„askβ–Ί
β—„fine_edgesoffβ–Ί
CategoryπŸ†Ž AusBoss/Mask

Inputs (13)

NameTypeDefaultDescription
imageIMAGEThe picture to pick from.
modelMODELSAM 3: MODEL from a Load Checkpoint that loads the SAM 3 file.
clipCLIPSAM 3's text reader: CLIP from the same Load Checkpoint.
touchesSTRINGWhat you picked on the node's picture. The node writes this itself when you click or paint; Clear on the node empties it.
growINT0-128–256Grow the picked area by this many pixels. Below zero shrinks it. 0 keeps the exact outline.
softenFLOAT0.00–100Soften the mask's edge by this many pixels. 0 keeps a hard edge.
smoothINT00–64Round off a ragged outline by this many pixels. 0 leaves the outline as found.
fill_holesBOOLEANtrueCloses pinholes inside the picked area. Larger openings stay open, like a mug's handle.
if_nothingCOMBOstop the runWhen nothing is picked. 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.
free_vramoptBOOLEANfalseTakes SAM 3 out of the graphics card's memory when the workflow has run this node. Turn it on in a workflow that loads a big model after this node.
invertoptBOOLEANfalseTurns the mask round: white everywhere except what you picked. With nothing picked the mask stays empty.
askoptSTRINGUsed by the node's own picture for a single run. Leave it empty: it is never saved with the workflow.
fine_edgesoptCOMBOoffHair and fur, strand by strand: where what you picked ends at the outline of the picture's main subject, that outline is taken from ComfyUI's background-removal model. The cut-out also loses the colour of the old background. Off keeps the edge as found. The ? page says where to get the model file.

Outputs (3)

NameTypeDescription
maskMASKWhite where the picked area is. One mask per picture.
cut_outIMAGEThe picture with everything but the picked area see-through (RGBA).
namesSTRINGThe names of the things you picked, in the order you picked them, like: jacket, hat. Empty when nothing you picked has a name.