Nodes/ymc-node-suite-comfyui/num - burn crop location (center & size)
ComfyUI Node

num - burn crop location (center & size)

From a center point and size to a full crop box

By YMC-GitHub·Created 3 years ago·Updated about a year ago· 20
num - burn crop location (center & size)
    • left
    • top
    • right
    • bottom
    • cx
    • cy
    • w
    • h
    cx128
    cy128
    w256
    h256

    Some regional-conditioning tools want a box described by its center, because that's how you think about "put this region in the middle of the face" - a center point plus a size. But most ROI nodes and masking utilities consume edge coordinates: left, top, right, bottom. num - burn crop location (center & size) converts between those representations and hands you every form as separate integer outputs.

    It's one of four region helper nodes in the ymc pack, and like the others it does zero inference - pure integer math that "burns" the crop location into explicit numbers you can wire anywhere. No models, no GPU, no image touched.

    How it works

    You give it a center cx, cy and a size w, h. The node derives the edges by walking half the size out from the center:

    • left = cx - w/2, right = cx + w/2
    • top = cy - h/2, bottom = cy + h/2

    with the same center and size echoed back through the outputs. Eight integer outputs total: left, top, right, bottom, cx, cy, w, h - the input form plus the derived edge form, so any downstream node can grab whichever representation it expects. Unused outputs just dangle; they cost nothing.

    Inputs and outputs

    Inputs (all INT, despite the "num" in the name - the values are integers here):

    • cx, cy - center of the region (defaults 128, 128)
    • w, h - width and height (defaults 256, 256)

    Outputs (all INT): left, top, right, bottom, cx, cy, w, h.

    Installing it

    Part of ymc-node-suite-comfyui:

    • ComfyUI Manager → search ymc-node-suite-comfyui → Install → restart, or
    cd ComfyUI/custom_nodes
    git clone https://github.com/YMC-GitHub/ymc-node-suite-comfyui
    

    restart, and pip install -r requirements.txt on a manual clone (four yors_* helper libs; the pack's auto-install is commented out). No models, no GPU.

    Find it under the right-click ymc suitetextregion menu, or search the canvas for burn crop.

    Common issues

    • The "num" vs "int" naming is a trap. Despite the name, this node's inputs are INT fields, not floats - the "num" just signals "I take numbers." The companion txt - burn crop location (cxcy & size) is the one that takes text strings. Don't overthink the taxonomy; check the input types when you reach for either.
    • It's coordinates only. Nothing is cropped or sampled here - this is a converter feeding whatever regional node you actually use.
    • Truncation on odd sizes. Half of an odd size truncates toward zero, so edges can be off by a pixel. Irrelevant for regional boxes.
    • WAS Node Suite conflicts on the pack's io/save nodes can appear as Manager warnings if you run both packs - unrelated to this node.

    If your center and size already exist as text (say, from a preset or an LLM node), use the txt variant and skip the manual ints; if you think in top-left corners instead, int - burn crop location (lt & size) is the one.

    Categoryymc suite/text/region

    Inputs (4)

    NameTypeDefaultDescription
    cxINT1280–10000000
    cyINT1280–10000000
    wINT2560–10000000
    hINT2560–10000000

    Outputs (8)

    NameTypeDescription
    leftINT
    topINT
    rightINT
    bottomINT
    cxINT
    cyINT
    wINT
    hINT