SAM3 - Remove Background via Prompt

Isolate any subject from an image using a text prompt — just type what you want to keep (e.g. `character`, `dog`, `car`) and the workflow cuts it out and saves it as a PNG with a transparent background.

Input

The photo to cut out.

Name what to keep, in a few words (e.g. "the teapot"); everything else is removed.

Default: character

Advanced settings

Alpha leaves a transparent PNG; Color fills the background with the colour below.

Used when Background is Color, as a hex value.

Default: #222222

Raise it if unrelated things are kept; lower it if parts of the subject go missing.

Keep everything except what you named.

Blurs the cut-out edge, in pixels.

Default: 0

Output
Output
Example

Try an example

About this workflow

This ComfyUI workflow isolates a subject from any image using a simple text prompt and exports a PNG with a transparent background. It links a LoadImage node to a SAM3Segment node, then into SaveImage. You type what you want to keep (for example, "character", "dog", or "red car"), and the SAM3Segment node generates a precise foreground mask and applies it as an alpha channel so everything else becomes transparent.

Technically, SAM3Segment performs prompt-aware segmentation over the input image, producing a binary mask for regions that best match the prompt. That mask is composited with the original RGB to produce an RGBA cutout. Because the node is designed to work well out of the box, most settings can remain at their defaults. The included MarkdownNote provides a quick reminder of the two essentials: connect an image and provide a clear prompt. SaveImage then writes the final cutout as a PNG, preserving transparency for downstream compositing in design, video, or web workflows.

Questions & answers