Nodes/ComfyUI-BBox-AutoRescale/Create Bounding Boxes (Auto-Rescale)
ComfyUI Node

Create Bounding Boxes (Auto-Rescale)

Same as Create Bounding Boxes, but when width/height come from a linked input (e.g. ResolutionSelector) and differ from the size the boxes were drawn in, the boxes are proportionally rescaled instead of being re-interpreted as-is.

By jambread-git·Created 3 days ago·Updated a day ago· 0
Create Bounding Boxes (Auto-Rescale)
  • editor_state
  • background
  • bboxes
  • last_incoming
  • preview
  • bboxes
  • elements
◄width1024►
◄height1024►
◄draw_width0►
◄draw_height0►
Categoryutilities

Inputs (8)

NameTypeDefaultDescription
widthINT102464–16384Width of the canvas and the pixel grid for the bounding boxes. Connect ResolutionSelector or any INT source here.
heightINT102464–16384Height of the canvas and the pixel grid for the bounding boxes. Connect ResolutionSelector or any INT source here.
editor_stateBOUNDING_BOXESDraw bounding boxes and set each box type, text, description, color palette. Start with background element first and foreground last. Boxes are stored in the canvas space you drew them in and are auto-rescaled to the effective (linked) width/height at run time.
draw_widthINT00–16384Internal use, managed automatically by the canvas frontend: the width the saved boxes were drawn in. Hidden from the UI; set to 0 to disable auto-rescale.
draw_heightINT00–16384Internal use, managed automatically by the canvas frontend: the height the saved boxes were drawn in. Hidden from the UI; set to 0 to disable auto-rescale.
backgroundoptIMAGEOptional image used as background in the canvas and preview.
bboxesoptBOUNDING_BOX,ARRAY,STRINGBounding boxes, elements, or a JSON string to initialize the canvas. A new upstream value initializes the canvas; edits made on the canvas take priority and are kept until the upstream value changes again.
last_incomingoptBOUNDING_BOXESInternal state managed by the canvas: the upstream bboxes value that last initialized it. Leave empty to re-initialize the canvas from the bboxes input on the next run.

Outputs (3)

NameTypeDescription
previewIMAGE—
bboxesBOUNDING_BOX—
elementsARRAY—