Nodes/comfyui-easy-sam3-tools/SAM3 Interactive BBox
ComfyUI Node

SAM3 Interactive BBox

Draw SAM3 boxes with your mouse instead of typing JSON coordinates.

By SuLU-K·Created 9 months ago·Updated 7 months ago· 9
SAM3 Interactive BBox
  • images
  • bboxs
  • images
bbox_data

This is the flagship of the pack - the node on the cover image, and the reason the pack exists. Sam3InteractiveBBoxEditor is a bounding-box authoring tool that lives inside the node itself. It streams your image into an editable canvas where you click-and-drag to draw boxes, drag the corner handles to refine them, hit Clear or Delete to tidy up, and then hands the finished boxes to SAM3 as prompt boxes. No JSON typing, no external app, no round-trip through a file.

In: images (IMAGE, required) and bbox_data (STRING, optional, multiline). Out: bboxs (BBOX) and images (the image, passed through untouched). The idea is simple: SAM3 (Meta's Segment Anything 3) takes box prompts and returns masks for exactly what you boxed. This node is how you box it. In a typical graph it sits between your loaded frame and the easy-sam3 segmentation node, with the bboxs output feeding the box prompt.

How it works (frontend and backend)

This one's a real two-part node, and it's worth knowing which part does what:

The web side. The pack ships a web/ extension that loads automatically with ComfyUI. When you run the graph, the Python side base64-encodes the first frame of your batch and pushes it to the frontend as a preview payload. The extension renders that image on a canvas inside the node and hands you a crosshair cursor. Drawing creates a box; the four corner handles resize it; the toolbar has Clear and Delete. Every change is serialized straight back into the node's bbox_data widget as JSON ({"boxes":[{"x":...,"y":...,"w":...,"h":...}]}), which is why editing the widget text works too - the canvas and the JSON are the same data, two views of it.

The Python side. On execution, collect parses bbox_data, accepts either the {x,y,w,h} style or the KJ {startX,startY,endX,endY} style, clips every box to the image bounds, drops any degenerate (≤1px) box, and returns the list in KJ format - startX/startY/endX/endY dicts, the format kijai's nodes and easy-sam3 expect. So the round trip is: draw in pixels → JSON → clamped KJ boxes.

What you actually set

  • images (IMAGE) - what you're drawing on. Only the first frame of a batch is previewed and boxed.
  • bbox_data (STRING, optional) - you can leave it empty and draw from scratch, or pre-seed it with JSON to start from an existing detection.

Outputs: bboxs (BBOX, wire into your SAM3 box prompt) and images (passthrough, so you can keep routing the original frame downstream).

Installing it

Standard pack install:

  • ComfyUI Manager → search comfyui-easy-sam3-tools → Install → restart.
  • Or:
cd ComfyUI/custom_nodes
git clone https://github.com/SuLU-K/comfyui-easy-sam3-tools

Then restart ComfyUI - the restart matters because the web extension only loads on startup. No extra dependencies, no models.

Where people get stuck

  • The canvas doesn't show anything. The preview comes from running the graph, not from connecting wires. Queue once, then the image appears in the node and you can draw on it. This trips everyone the first time.
  • Only the first frame is editable. Feed it a video and you get frame 0. Box that frame, run the frame through SAM3, repeat per frame - or wire the frame you want via a frame selector upstream.
  • Tiny boxes vanish. Anything under 1px in either dimension is dropped on purpose; it's a guard against accidental zero-size clicks, not a bug.
  • Coordinates changed shape. Input accepts {x,y,w,h} but output is KJ {startX,startY,endX,endY}. If you hand the output to a node that only understands one style, check which one it wants.

Once you've drawn boxes, pair the bboxs with Sam3DrawBBox (to see them overlaid) or Sam3MaskRangeSelector (to pick which of the resulting masks you actually keep). That's the whole pipeline, and this editor is the part that makes it feel like a tool instead of a spreadsheet.

CategoryTest Nodes/SAM3

Inputs (2)

NameTypeDefaultDescription
imagesIMAGE
bbox_dataoptSTRING

Outputs (2)

NameTypeDescription
bboxsBBOX
imagesIMAGE