Nodes/MTB Nodes/Bbox (mtb)
ComfyUI Node Runs on cloud

Bbox (mtb)

Build a crop box by hand from x/y/width/height

By melMass·Created 3 years ago·Updated about a month ago· 721
Bbox (mtb)
    • BBOX
    x0
    y0
    width256
    height256

    This is the plain, manual way to make a bounding box in MTB. You type in a position and a size - x, y, width, height - and it hands back a BBOX, the little coordinate object that MTB's crop and uncrop nodes consume. Think of it as the "I know exactly which rectangle I want" node, the counterpart to Bbox From Mask, which derives a box from a mask automatically.

    Why does a bounding-box type even exist as its own node? Because the crop-process-paste pattern needs somewhere to keep the rectangle. You crop a region out of an image, do some work on just that region at full detail, then paste it back exactly where it came from - and the box is the shared piece of information that says "here's where this region lives." Bbox (mtb) is how you define that region by hand when you don't have a mask to derive it from.

    How it works

    Nothing computes - it packages four numbers into MTB's BBOX structure. Instant, no model, no image even required as input.

    The inputs and output

    • x and y - the top-left corner of the box, in pixels.
    • width and height - the box size in pixels (both default to 256).

    The single output is BBOX. It goes into MTB's crop nodes - typically Crop From Bbox to cut the region out, then Bbox / Uncrop to put the processed result back. The box is the glue that keeps "where I cut" and "where I paste" consistent.

    How to install it

    ComfyUI Manager: search MTB Nodes (comfy_mtb), install, restart. Or manually: cd ComfyUI/custom_nodes && git clone https://github.com/melMass/comfy_mtb and restart. Pure Python - nothing to download.

    Common issues

    The gotchas here are all about coordinates. MTB's BBOX is measured in pixels, and the origin (0,0) is the top-left of the image, so y increases downward. If your crop lands in the wrong place, you've almost certainly mixed up which corner you're specifying or you're thinking in a bottom-left coordinate system.

    The second thing: nothing stops you from defining a box that runs off the edge of the image - an x plus width larger than the image is wide. Depending on the crop node downstream, that either clamps to the image bounds or produces a smaller-than-expected region. If your crop is coming out truncated, check that the box actually fits inside the image you're cropping.

    Finally, remember this box only speaks MTB. Its BBOX isn't the same format as the bounding boxes other packs (like Impact Pack) use, so keep it within the MTB crop family. When you'd rather have the box computed for you from a subject rather than typed in, that's Bbox From Mask's job.

    Categorymtb/crop

    Inputs (4)

    NameTypeDefaultDescription
    xINT00–10000000
    yINT00–10000000
    widthINT2560–10000000
    heightINT2560–10000000

    Outputs (1)

    NameTypeDescription
    BBOXBBOX