ComfyUI Node Runs on cloud

SAM Image Mask

Point at an object and let Segment Anything mask it

By WASasquatch·Created 3 years ago·Updated about a year ago· 1,812
SAM Image Mask

      This is WAS's hook into Meta's Segment Anything Model - the "click a thing, get a perfect cutout of that thing" model. Instead of hand-painting a mask or thresholding a fuzzy salience map, you hand SAM some point coordinates and it segments whatever object those points land on, edges and all. The output is a clean mask of that specific object.

      That "specific object" part is the whole reason SAM exists and why it's different from background removal. Rembg or BiRefNet answer "foreground vs background." SAM answers "that object, the one I pointed at" - the red dress, the left person, the coffee cup and not the saucer. It's targeted selection for when you need one thing masked, not everything separated from the backdrop.

      How it works, and the three-node dance

      SAM in WAS is a small pipeline, not a single node:

      1. SAM Model Loader loads the segmentation model (it downloads on first use).
      2. SAM Parameters is where you define the point coordinates that tell SAM what to grab (and, via SAM Parameters Combine, stack several point sets).
      3. SAM Image Mask is the node here - it takes the model, the image, and those parameters, runs the segmentation, and returns the masked result.

      So you feed it the loaded SAM model, the image, and your parameters; it outputs the segmented image and a MASK. That mask then goes where every mask goes: an inpaint pass, a composite, a region-specific regeneration.

      The inputs and outputs that matter

      • sam_model - from SAM Model Loader.
      • image - the picture to segment.
      • sam_parameters - the point coordinates/labels from the SAM Parameters node. This is the input that actually steers what gets masked.

      Outputs: the segmented IMAGE and a MASK of the selected object. The mask is the one you'll usually wire onward.

      Installing it

      Ships with WAS Node Suite. ComfyUI Manager: search WAS Node Suite, install, restart. Or:

      cd ComfyUI/custom_nodes
      git clone https://github.com/WASasquatch/was-node-suite-comfyui
      

      install requirements.txt against your ComfyUI Python, then restart. The SAM weights come down on first run.

      Common issues

      The mask grabbed the wrong thing (or nothing). SAM here is driven by coordinates you specify, not by clicking on a live preview. If your points land on the wrong spot, you get the wrong object. This is the fiddly part of WAS's SAM - you're specifying x/y positions and hoping they hit the target, without the interactive click-to-segment UI that newer tools have. Preview your image, work out the coordinates, and expect a couple of tries.

      First run hangs or errors on the model. SAM has to download. If the fetch fails, the loader has nothing to give the mask node. Check that the model actually landed on disk and re-run.

      Every WAS node disappeared. That's the pack, not SAM. WAS Node Suite is retired and unmaintained; after a ComfyUI update its dependency pins clash and the suite throws "Import Failed," killing all its nodes until you reinstall requirements.txt against the correct ComfyUI venv.

      Honest take: WAS's SAM works, but it's the old, coordinate-driven approach. In 2026 most people doing targeted masking reach for newer paths - Impact Pack's SAM detector (its detect-crop-refine loop is the standard detailing workflow), the RMBG pack's bundled SAM2/SAM3 with text-to-mask, or GroundingDINO to name an object in words and let SAM mask it. If you already have WAS installed and just need a quick object mask, this is right there. If masking is central to your workflow, the interactive/text-prompted options are worth the extra install.

      Categoryx

      Inputs (0)

      No inputs

      Outputs (0)

      No outputs