ComfyUI Node

Canvas BBox

The bbox annotation canvas

By yichengup·Created 10 months ago·Updated 4 months ago· 59
Canvas BBox
    • width
    • height
    • bbox_1
    • bbox_2
    • bbox_3
    • bbox_4
    • bbox_5
    • bbox_6
    • bbox_7
    • bbox_8
    • bbox_9
    • bbox_10
    canvas_width512
    canvas_height512
    bbox_data

    Bounding boxes are everywhere in ComfyUI workflows - FaceDetailer wants one, regional conditioning wants them, detection nodes emit them - but there's no stock way to just draw a few rectangles on a canvas and read the coordinates out. Canvas BBox is a tiny drawing canvas for exactly that: you set the canvas size, drag rectangles onto it, and it hands you each rectangle as an x,y,width,height string plus the canvas dimensions.

    The author credits Smirnov75's ComfyUI-mxToolkit as the base, and it shows in the best way: this is a widget, not a workflow. Set canvas_width and canvas_height (64–4096), draw on the node face, done.

    How it works

    The rectangles serialize into bbox_data as x,y,w,h;x,y,w,h;.... On run, the node parses up to ten of them and pads the rest with empty strings. That's the whole mechanism - no torch, no model, just string parsing. The width and height outputs simply echo your canvas size.

    Outputs: width, height, and bbox_1 through bbox_10 (ten STRING slots). Each bbox_N is the exact x,y,w,h text you'd feed into any node that consumes that format - or into this pack's own BBox Bridge if your target speaks a different dialect.

    Why you'd reach for it

    Three honest use cases: debugging (see exactly what a detector thinks a region is), setting up regional conditioning by hand, and annotating for an external tool. It's also a decent way to prototype bbox layouts before you trust them to an automated detector. Ten slots is the ceiling, so don't plan a 40-region face detail pass around it.

    One thing to remember: unused slots come out as "". Downstream nodes that naively parse an empty string will choke - filter empties before feeding them anywhere strict.

    Installing

    Same pack, same steps as everything in ComfyUI-YCNodes_Toolkit:

    cd ComfyUI/custom_nodes
    git clone https://github.com/yichengup/ComfyUI-YCNodes_Toolkit
    

    Restart, and you'll find it under the YCNodes Toolkit category. Only numpy and Pillow are required - no models, no heavy deps. If you're already running the pack for Load Image Crop Expand, this node just shows up.

    CategoryYCNode/utils

    Inputs (3)

    NameTypeDefaultDescription
    canvas_widthINT51264–4096
    canvas_heightINT51264–4096
    bbox_dataSTRING

    Outputs (12)

    NameTypeDescription
    widthINT
    heightINT
    bbox_1STRING
    bbox_2STRING
    bbox_3STRING
    bbox_4STRING
    bbox_5STRING
    bbox_6STRING
    bbox_7STRING
    bbox_8STRING
    bbox_9STRING
    bbox_10STRING