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

txt - burn crop location (cxcy & size)

Center + size as strings, full crop box out

By YMC-GitHub·Created 3 years ago·Updated about a year ago· 20
txt - burn crop location (cxcy & size)
    • left
    • top
    • right
    • bottom
    • cx
    • cy
    • w
    • h
    cxcy128,128
    size256,256

    Every once in a while your region coordinates arrive as text - a preset string, a config file, an LLM node that emits "128,128" for a center and "256,256" for a size. The txt - burn crop location (cxcy & size) node is the one that eats strings and spits out the full box as integers.

    It's the string-input sibling of num - burn crop location (center & size) in the ymc pack's region family. Same math, same eight integer outputs, different front door: instead of four INT fields you get two STRING fields in "x,y" form, which the node parses and converts.

    How it works

    You supply:

    • cxcy - a comma-separated string, default "128,128" (the box center)
    • size - a comma-separated string, default "256,256" (width, height)

    The node splits each on commas, converts to integers, then computes the edges the same way as the numeric sibling: left = cx - w/2, right = cx + w/2, top = cy - h/2, bottom = cy + h/2. Out come eight INT outputs: left, top, right, bottom, cx, cy, w, h.

    Why bother with a string input at all? Because it makes the node wireable to text sources directly - and because "cx,cy" + "w,h" is a compact, human-editable format that survives JSON round-trips and preset systems better than four separate widgets.

    Inputs and outputs

    • cxcy - STRING, center as "cx,cy" (default "128,128")
    • size - STRING, size as "w,h" (default "256,256")
    • Outputs (INT × 8): left, top, right, bottom, cx, cy, w, h

    Whitespace around the numbers is fine - " 128 , 128 " parses correctly.

    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

    • Malformed strings error out. The parse expects two comma-separated integers per field. A stray letter, a single number, or an empty field raises a conversion error rather than a graceful fallback - check your source string if a run fails.
    • It's cx,cy order, not x,y. The center field is center-x then center-y, same as everywhere in this pack, but worth saying once because "128,128" hides the order.
    • Strings only - no sliders. If you'd rather tweak numbers by hand in the node, use the num variant (which, despite its name, uses int fields).
    • 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 regional pipeline keeps coordinates as text - which is common when you're generating boxes from a preset or a script - this is the least-friction way to turn them into the integer edge/center outputs that ROI and mask nodes consume.

    Categoryymc suite/text/region

    Inputs (2)

    NameTypeDefaultDescription
    cxcySTRING128,128
    sizeSTRING256,256

    Outputs (8)

    NameTypeDescription
    leftINT
    topINT
    rightINT
    bottomINT
    cxINT
    cyINT
    wINT
    hINT