Crop (mtb)
Crop an image and mask together, by coordinates or a wired BBOX
- image
- mask
- bbox
- IMAGE
- MASK
- BBOX
Crop is one of MTB Nodes' oldest and plainest utilities, and it's a good example of what this pack is at its core: small, general-purpose image operations that core ComfyUI doesn't ship on its own. It crops an image - and, if you give it one, a mask alongside it - to a bounding box, and hands the box itself back out so you can reverse the operation later.
Two ways to give it a crop region
Straight from the node's own description: the bounding box can be given either as loose x, y, width, height widgets, or as a wired BBOX input, and the BBOX input takes precedence if both are present. That matters in practice - if you're feeding this node a BBOX from a detector upstream (a face-detection node, say, or MTB's own BBox Force Dimensions) but also have leftover widget values from earlier testing, the wired BBOX wins silently. Know which mode you're actually in before debugging an unexpected crop region.
The inputs and outputs that matter
image(required) - the source to crop.mask(optional) - cropped in lockstep with the image if you provide one, so image and mask stay aligned.x,y,width,height(optional, defaults 0, 0, 256, 256) - the manual crop rectangle. The widget max is a huge 10,000,000, which in practice just means the widget places no real ceiling on you - normal image dimensions are nowhere near that limit.bbox(optional) - a wiredBBOX, overriding the manual coordinates above when present.
It returns three things: IMAGE (the cropped image), MASK (the cropped mask, if one was given), and BBOX - the actual box that was used for the crop. That last output is easy to overlook but genuinely useful: keep it around and you can composite the cropped, processed result back into the exact original position later with an uncrop-style node, without re-deriving the coordinates by hand.
Installing it
ComfyUI Manager: search MTB Nodes, install, restart. Or:
cd ComfyUI/custom_nodes
git clone https://github.com/melMass/comfy_mtb
then restart ComfyUI. No models, no extra dependencies - this is tensor slicing.
Common issues
The precedence rule above is the one thing that actually confuses people: set your x/y/width/height widgets, get a crop that doesn't match them, and the reason is almost always a BBOX still wired in from earlier in the graph taking priority. Disconnect it if you want the manual widgets to actually apply.
Beyond that, the pack-wide caveat: MTB logs [comfy_mtb] Some nodes (N) could not be loaded at startup instead of crashing when a node fails to import, with a pointer to http://127.0.0.1:8188/mtb for the real cause - confirmed by other users' actual install logs. If Crop doesn't show up after installing, check that line before reinstalling.
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| maskopt | MASK | — | |
| xopt | INT | 00–10000000 | — |
| yopt | INT | 00–10000000 | — |
| widthopt | INT | 2560–10000000 | — |
| heightopt | INT | 2560–10000000 | — |
| bboxopt | BBOX | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |
| MASK | MASK | — |
| BBOX | BBOX | — |