SAM3 · mask from words

Say what to mask ("the coffee cup", "her jacket", "the red cap") and get a mask of every instance at the source size.

Discover · Wavemaker catalog

When to use it

  • A mask for qwen-edit-inpaint-crop: swap the mug for a branded can.
  • A mask for lama-remove: take the sugar packets off the table.
  • A cutout of one named object from a busy scene.

What you provide

  • One owned still bound to source.image and the object in mask.prompt; optionally mask.confidence_threshold, mask.segment_pick, mask.mask_offset.

What you get

  • save_mask: greyscale PNG, white = the object.
  • save_cutout: RGBA PNG.

Creative guidance

  • A mask from words: SAM3 finds every instance of what mask.prompt names ("coffee cup", "spoon", "red cap", "sugar packet") and traces it. Outputs save_mask (greyscale PNG at the source size, white = the object) and save_cutout (RGBA PNG). save_mask binds unchanged as mask_source.image of qwen-edit-inpaint-crop / qwen-edit-inpaint or lama-remove. Bind inputs.media {"source.image": sha256} and inputs.bindings {"mask.prompt": "..."}; mask.confidence_threshold (0.5) drops weak matches, mask.segment_pick (1 = the strongest) keeps one instance, mask.mask_offset grows (+) or shrinks (-) the mask in pixels (small values: each step is a full-image filter pass, 6 took 18 s on a 1280x1920 still). Name the region you want: on a top-down cup, "coffee cup" masked only the ceramic and "cup of coffee" the cup with the coffee in it. Nothing found gives an all-black mask: look at save_mask before using it. Runs on the masks T4 variant (masks-image-t4-20261025, one T4). Direct runs on its image 2026-10-25: sandbox start about 32 s, SAM3 21 s cold (model load), 4-5 s warm per still. Guide: examples/image-matting/README.md. Offered since 2026-12-02, after one production run by name on masks-image-t4-20261025-prd (see evidence).

Setup and requirements

  • Runtime: comfy. Load the listed model weights and node dependencies.

Things to know

  • Masks what the words say: "coffee cup" can leave the coffee out, "cup of coffee" includes it.
  • Nothing found gives an all-black mask; check save_mask before you use it.
  • Runs on one T4: a still is about 40 s on a cold worker (startup dominates), 4-5 s warm.

Example brief

Mask the coffee cup in this photo, then replace it with a red soda can in the same light.

Source licenses and model terms continue to apply. Check runtime availability before generation.

Download source · Learn how to reuse resources

Related resources