LayerUtility: CropBoxResolve
CropBoxResolve — unpack a crop box into plain numbers
- crop_box
- x
- y
- width
- height
A one-job adapter node. LayerStyle's crop nodes (CropByMask and friends) hand you back a crop_box - an opaque BOX type that packages up a crop rectangle in one connector. That's convenient for wiring straight into a paste-back node, but it's useless the moment you want to do something with the numbers - math on the width, a display readout, feeding one coordinate into a node that only accepts a plain INT. This node exists to crack that box open.
It's the kind of node you don't think about until you need it, and then you're glad it exists instead of writing a tiny custom script node to do the same thing.
How it works
There's no computation here - it just reads the four fields packed into a BOX and exposes each one as its own typed output. Think of it as the inverse of whatever built the BOX in the first place: a crop node packs four numbers into one connector because that's tidy for wiring to a single paste-back node; this one unpacks them again the moment you need to treat those numbers individually instead of as a bundle.
The inputs and outputs that matter
crop_box- theBOXinput, typically wired straight from a crop node'scrop_boxoutput (this pack'sCropByMaskis the usual source).
Four outputs, one per field: x, y (top-left corner), width, height - all plain INT. Wire any of them into math nodes, a text/label node for debugging, or a condition check (Boolean Operator, for instance) that needs a real number rather than an opaque box. A common pattern: pull width/height out to decide whether a detected region is even worth running an expensive detailer pass on, or feed x/y into a separate compositing node that doesn't happen to accept the pack's BOX type natively.
How to install it
Ships with the ComfyUI Layer Style pack. ComfyUI Manager - search ComfyUI Layer Style, install, restart. Manual:
cd ComfyUI/custom_nodes
git clone https://github.com/chflame163/ComfyUI_LayerStyle
pip install -r ComfyUI_LayerStyle/requirements.txt
then restart. Lives under 😺dzNodes → LayerUtility. No models needed.
Common issues & troubleshooting
There's very little to go wrong in this node specifically - it's a pure unpacking operation with no logic to misconfigure. The one thing worth knowing: the crop coordinates it hands you are relative to whatever image the upstream crop node worked from, so if you're doing math with them downstream (checking if a crop is near the canvas edge, say), make sure you're comparing against that same image's dimensions and not a resized copy of it. If you've since scaled the cropped patch up or down before this node runs, width/height describe the original crop, not the scaled version - don't feed them into math that assumes they match what's currently on your canvas.
Node's not showing up in your palette. That's a pack-level import failure, not this node. LayerStyle's dependency chain is long, and a broken transformers/stray-TensorFlow pairing is the classic way the entire pack fails to load, taking every node - including small utility ones like this - down with it. Check the startup console or hit "Try Fix" in ComfyUI Manager.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| crop_box | BOX | — |
Outputs (4)
| Name | Type | Description |
|---|---|---|
| x | INT | — |
| y | INT | — |
| width | INT | — |
| height | INT | — |