Nodes/ComfyUI-KYNode/BBox Image Position
ComfyUI Node

BBox Image Position

Turn coordinates into a usable box

By yorkane·Created 2 years ago·Updated 6 months ago· 10
BBox Image Position
    • position
    • description
    • bbox
    • x
    • y
    • width
    • height
    x0
    y0
    width100
    height100
    image_width1920
    image_height1080

    This one doesn't touch a single pixel. It's a pure geometry node: you type in a box (x, y, width, height) and the dimensions of the image it lives in (image_width, image_height), and it hands you back that box as a proper structured BBOX you can wire into other nodes, plus a couple of plain-text summaries of where it sits.

    Why you'd want this

    If you're working with detection-and-crop workflows - the same detect-crop-refine pattern behind Impact Pack's FaceDetailer, where a region gets found, cropped, resampled, and composited back - you sometimes already know the coordinates you want (from a previous test, from an external tool, from doing the math by hand) and just need them packaged into a real BBOX object rather than four loose integers scattered across your graph. This node is that packaging step, plus it echoes back the raw numbers and generates a couple of human-readable descriptions of the box's position, which is handy if you want to sanity-check your numbers or feed a text description into a prompt or logging node.

    The inputs and outputs

    All six inputs are plain integers with sensible defaults: x/y default to 0,0 (top-left corner), width/height default to 100×100, and image_width/image_height default to 1920×1080 - you'll almost always want to override that last pair to match your actual image.

    You get seven outputs back: a position string and a description string (both presumably summarizing where the box sits relative to the frame - the exact wording isn't documented, so treat them as human-readable context rather than something to parse programmatically), a proper bbox object of type BBOX, and then x/y/width/height echoed straight back out as integers - useful if you want to do further math on them downstream without re-typing the same numbers into another node.

    Installing it

    ComfyUI Manager: search ComfyUI-KYNode, install, restart. Or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/yorkane/ComfyUI-KYNode
    

    Restart ComfyUI. Nothing to download, no external binaries - it's arithmetic on six integers. Worth knowing up front: this is a small personal-toolbox pack with a thin README and essentially no discussion anywhere in the wider ComfyUI community, so don't expect polish or documentation beyond what the node itself tells you.

    Common issues

    There's no bounds-checking implied anywhere in the schema - nothing stops you from setting x + width past image_width, and the node has no way to know your real image's dimensions unless you type them in correctly. If a downstream crop comes out wrong or errors, the first thing to check is whether image_width/image_height here actually match the real image you're cropping, not the 1920×1080 default that's easy to forget to change.

    Second, this node produces a BBOX, singular - if a downstream node in this same pack expects the plural BBOXES type (like KY_BBoxesToSAM2), you'll need to route through the right converter rather than wiring this straight in; BBOX isn't perfectly standardized across every pack either, so if you're feeding the output into a detector/crop node from a different pack entirely, check that its expected box format actually matches what this one produces.

    Finally, since this node does no image processing at all, if your crop looks visually wrong even though the math checks out, the bug is almost certainly downstream - in whichever crop node consumes the bbox output - not in this one.

    CategoryKYNode/BBox

    Inputs (6)

    NameTypeDefaultDescription
    xINT00–10000
    yINT00–10000
    widthINT1001–10000
    heightINT1001–10000
    image_widthINT19201–10000
    image_heightINT10801–10000

    Outputs (7)

    NameTypeDescription
    positionSTRING
    descriptionSTRING
    bboxBBOX
    xINT
    yINT
    widthINT
    heightINT