Nodes/lzits Nodes/Bounding Box Draw
ComfyUI Node

Bounding Box Draw

Drag two boxes and move an object

By lzitser23·Created 9 months ago·Updated 3 months ago· 0
Bounding Box Draw
  • image
  • conditioned_image
  • source_image
source_x10
source_y10
source_x20
source_y20
target_x10
target_y10
target_x20
target_y20
line_width3

Some LoRA workflows boil down to a spatial instruction: this thing is here, I want it there. That's what object-move LoRAs do, and it's a workflow that used to mean hand-typing eight coordinate values into the graph and praying you got them right. Bounding Box Draw replaces that with an in-node canvas: you drag a red box over the object and a green box over where you want it to end up.

How it works

Under the hood it's a plain ComfyUI node with eight INT coordinate inputs - source_x1/y1/x2/y2 and target_x1/y1/x2/y2 - plus a line_width. A small JavaScript extension hides those widgets, draws your image as the canvas background, and syncs the boxes you drag back into the INT values. That means the coordinates are real graph data: they serialize into the workflow JSON, survive save/load, and travel to Python exactly like any other input.

Two outputs come out:

  • conditioned_image (IMAGE) - the image with the red source box and green target box drawn on it. This is the visual conditioning you feed to the object-move LoRA's image input.
  • source_image (IMAGE) - the clean, unmodified passthrough. The frontend uses it as the canvas background; you can also use it anywhere you need the original.

The inputs that matter

  • image - the frame to draw on.
  • source_* and target_* - box corners in pixels. You normally never touch these directly; the canvas writes them.
  • line_width (1–20, default 3) - box stroke thickness.

The canvas mode button toggles between drawing the source (red) and target (green) box. Boxes under 4×4 px are ignored as misclicks, and there's a Clear All button.

Gotchas

  • You have to run the graph once to see your image in the canvas. Connect the image, run, and the background loads (it can also pull the upstream node's cached preview without a run - there's a ⟳ refresh button for when that fails). Until then the canvas is blank.
  • Boxes are in raw pixels of the displayed image, so a 512×512 source displayed large still produces coordinates on the original scale - that's what you want for feeding a LoRA that expects image-space boxes.
  • If your object-move workflow has its own box-prep node, the four source INTs here are drop-in compatible: this pack's ObjectSelector (after YOLOGetBoxes) outputs x1, y1, x2, y2 in exactly the same shape.

Installing this node

One of the 16 nodes in the lzits Nodes pack (Lior Zitser, MIT). Install via ComfyUI Manager (search "lzits Nodes") or:

cd ComfyUI/custom_nodes
git clone https://github.com/lzitser23/lzits-nodes.git

Restart ComfyUI. The web extension lives in the pack's web/ folder and loads automatically - no extra dependencies.

Categorylzits nodes

Inputs (10)

NameTypeDefaultDescription
imageIMAGE
source_x1INT00–8192
source_y1INT00–8192
source_x2INT00–8192
source_y2INT00–8192
target_x1INT00–8192
target_y1INT00–8192
target_x2INT00–8192
target_y2INT00–8192
line_widthINT31–20

Outputs (2)

NameTypeDescription
conditioned_imageIMAGE
source_imageIMAGE