SEGS from SAM Output
Unprompted segmentation for when you want every region, not just the cat
- image
- sam_model
- segs
- overlay
Most segmentation asks a question: "find me the faces," or "find the thing matching this text." SimpleSyrup.SEGSFromSAMOutput asks a different one: "just segment everything." It runs SAM in its automatic, unprompted mode - the same mode that produces those exploded-into-colorful-regions images you've seen - and hands you every region it finds as SEGS. No text prompt, no detector, no class names.
Why would you want that? Because "everything" is sometimes exactly right. You're building a regional workflow and don't know in advance which objects matter - let SAM carve the image into regions, browse them, and pick. You want to mask out all foreground objects from a background. You're exploring a composition and want to see what the model perceives as distinct things. SAM's automatic mode is good at this precisely because it's agnostic - it finds blobs and object boundaries without deciding what they mean, which makes it a great discovery tool before you commit to a specific prompt or detector.
Inputs:
imageandsam_model- the image to segment and a SAM model from SAM Model Loader (or any compatibleSAM_MODELsource).segmentation_resolution- the maximum long edge, in pixels, used for segmentation (default 640). Lower runs faster and omits small details; higher catches finer regions but costs time and memory. Start at 640 and raise it only if the granularity disappoints.minimum_region_area- discard masks smaller than this many pixels in the original image (default 0 = keep everything). This is your spec-killer: SAM auto-mode finds a lot of noise regions, and a nonzero floor here is the difference between 5 usable regions and 50 mostly-empty ones.
Outputs:
segs- the automatic regions, one per image, as SEGS.overlay- the source image with retained regions drawn as translucent colors. This is the fastest way to see what you got without touching the SEGS itself.
The overlay output is worth wiring up as a preview even when you think you don't need it. It takes SAM's raw segmentation output and makes it legible, and "look at the overlay, then tune minimum_region_area" is the actual tuning loop for this node.
It plays into the same ecosystem as the rest of the pack - the SEGS output feeds detailers, the pack's regional nodes, or tiled diffusion contexts. Since SimpleSyrup SEGS are Impact-compatible, you can hand these regions to Impact Pack nodes too.
Install: the pack:
cd ComfyUI/custom_nodes
git clone https://github.com/Artificial-Sweetener/SimpleSyrup
cd SimpleSyrup && pip install -r requirements.txt
or ComfyUI Manager → search SimpleSyrup → Install → restart, with a current ComfyUI (v3 extension API). You'll need a SAM model (auto-downloadable via the loader) and the segment-anything package, both part of the pack install. If the output is a sea of tiny regions, raise minimum_region_area and lower segmentation_resolution - you're trading detail for sanity, and for auto-segmentation you usually want the sane version.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | Image whose automatic regions become SEGS. | |
| sam_model | SAM_MODEL | SAM model used to find unprompted image regions. | |
| segmentation_resolution | INT | 64064–8192 | Maximum long edge in pixels used for segmentation. Lower values run faster and omit smaller details. |
| minimum_region_area | INT | 00–268435456 | Discard masks smaller than this many pixels in the original image. |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| segs | SEGS | Automatic image regions as SEGS for detailing, masking, or tiled diffusion. |
| overlay | IMAGE | Source images with retained SAM regions shown as translucent colors. |