Nodes/DIGIT Nodes/DIGIT Crop Info
ComfyUI Node

DIGIT Crop Info

Turn a drag-crop's JSON into numbers the rest of your graph can use

By thedepartmentofexternalservices·Created 7 months ago·Updated 2 months ago· 0
DIGIT Crop Info
    • left
    • top
    • right
    • bottom
    • width
    • height
    • csv
    • pretty
    ◄crop_json►

    DIGIT Crop Info is the tiny companion node that exists for one reason: the DIGIT Drag Crop node hands you a CROP_JSON string, and ComfyUI's graph mostly wants plain integers. This node takes that JSON apart and gives you the crop offsets and dimensions as individual numeric outputs, ready to wire anywhere.

    It's the least glamorous node in the pack and it knows it. There's one input (crop_json, straight from Drag Crop's CROP_JSON output) and a pile of outputs. No settings to tune, no cloud calls, no API keys - it's a pure data-shaping utility.

    What it gives you

    • left, top, right, bottom - the four crop offsets in pixels, as separate INT outputs.
    • width, height - the cropped region's dimensions.
    • csv - all the values as one comma-separated string, handy if a node downstream wants them inline.
    • pretty - a human-readable formatted string, which is what you'd eyeball in a text field to confirm the crop is what you think it is.

    The reason these outputs exist is that crops end up feeding all sorts of things: a crop-style resize, a mask alignment, an inpainting region, a bbox for downstream processing. Having left/top as actual integers you can attach to anything beats parsing a JSON string by hand every time.

    Installing and using it

    Part of the digit-comfyui pack, installed the standard way:

    cd ComfyUI/custom_nodes
    git clone https://github.com/thedepartmentofexternalservices/comfyui-digit.git
    cd comfyui-digit
    pip install -r requirements.txt
    

    Or ComfyUI Manager → search comfyui-digit → install → restart.

    In a workflow it slots right after Drag Crop: drag your crop box, connect CROP_JSON into Crop Info, and the numbers appear on the node. There's no real failure mode to worry about - the only thing that breaks is feeding it a non-CROP_JSON string (don't), or expecting it to do something it doesn't, because it genuinely does just this one thing.

    The honest take

    You could live without this node - you could paste the JSON into a text editor and read the numbers off it, the way people did before. But if you're building anything where the crop region drives further processing, having the values as first-class graph outputs means you can string together "crop here, then do X with those exact numbers" without a manual transcription step. It's a two-second node that quietly removes a whole class of "wait, I typed the wrong offset" mistakes. Sometimes the most useful nodes are the boring ones that just convert a format.

    CategoryDIGIT

    Inputs (1)

    NameTypeDefaultDescription
    crop_jsonSTRING—

    Outputs (8)

    NameTypeDescription
    leftINT—
    topINT—
    rightINT—
    bottomINT—
    widthINT—
    heightINT—
    csvSTRING—
    prettySTRING—