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

int - burn crop location (lt & size)

Turn a top-left crop box into every coordinate form

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

    Regional prompting - splitting your image into areas with different conditioning - runs on bounding boxes, and different regional tools want those boxes in different formats. Some want the top-left corner plus width/height. Others want the four edges (left, top, right, bottom). Others want a center point and a size. int - burn crop location (lt & size) takes the first form and hands you all the rest, as separate integer outputs.

    It's one of four region helper nodes in the ymc pack, and they're all pure math - no models, no inference, just coordinate arithmetic "burned" into explicit numbers you can wire anywhere.

    How it works

    You give it a rectangle the way you'd describe a crop in any image editor: left and top are the top-left corner, w and h are the size. The node derives everything else from those four values:

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

    All integer math (the pack truncates the half-pixels). Out the other side you get eight integer outputs: left, top, right, bottom, cx, cy, w, h - every coordinate representation a regional/ROI node might want, in one box. Pick the outputs you need and leave the rest dangling; unused outputs cost nothing.

    Inputs and outputs

    Inputs (all INT):

    • left, top - top-left corner of the region (defaults 0, 0)
    • 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.

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

    Common issues

    • It's math, not a crop. This node doesn't touch an image; it just computes coordinates. Wire its INT outputs into whatever regional conditioning or ROI node you're actually using.
    • Negative coordinates are fine. left/top allow values up to 10,000,000 and down to 0 - if you need off-canvas boxes, this isn't the constraint; the pack's siblings accept the same ranges.
    • Rounding is truncation. Integer math truncates, so cx for an odd width rounds toward zero. For regional boxes that's negligible - nobody crops at half-pixel precision.
    • 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 coordinates start from a center point instead of a corner, the sibling num - burn crop location (center & size) does the same conversion from cx, cy, w, h; if they come in as text strings, the txt variant parses them for you.

    Categoryymc suite/text/region

    Inputs (4)

    NameTypeDefaultDescription
    leftINT00–10000000
    topINT00–10000000
    wINT2560–10000000
    hINT2560–10000000

    Outputs (8)

    NameTypeDescription
    leftINT
    topINT
    rightINT
    bottomINT
    cxINT
    cyINT
    wINT
    hINT