CropMask_motorway_edition
Crop a mask by x/y/width/height, routed through the Motorway
- MOTORWAY ππ¨
- MOTORWAY ππ¨
If you've ever needed to isolate one region of a mask - say, grab just the face region of a full-body segmentation mask so you can detail only that - you know the core CropMask node. Give it the mask and an x/y/width/height box and it returns just that rectangle. This _motorway_edition is that node rehosted on agilly1989's Motorway bus, so instead of a mask going in on a wire and coming out on a wire, the mask is already in the bus and you just tell the node which keys to use.
How it works
Mechanically it's the core CropMask from nodes.py - it crops the MASK tensor to the pixel box you specify and returns the cropped mask. The Motorway wrapper pulls the mask out of the bus by INPUT_mask_key, applies the crop with the four widget values, and stores the result under OUTPUT_MASK_key. That's the entire job. Where it gets genuinely handy in a Motorway workflow is when your pipeline already computed a mask (segmentation, bbox detection, inpainting prep) and parked it in the bus - you crop it here without ever routing the tensor back onto the wire.
Inputs and outputs
- MOTORWAY ππ¨ - the bus, required.
- INPUT_mask_key - key of the mask to crop, default
mask. - x / y - top-left corner of the crop box in pixels (0β16384).
- width / height - size of the crop (1β16384, defaults 512Γ512).
- OUTPUT_MASK_key - key for the cropped mask, default
MASK.
Output is the updated MOTORWAY ππ¨; read the mask back out with a Motorway AxB ramp node. A note on the box: x/y/width/height here are plain widget integers you set on the node - they don't come from the bus, so if your box should follow something dynamic like a face-detection bbox, you'll want to write those ints into the Motorway upstream and... well, this variant won't read them. That's a real limitation of the auto-generated clone: only non-primitive inputs become keys.
Installing
With the pack:
cd ComfyUI/custom_nodes
git clone https://github.com/agilly1989/ComfyUI_agilly1989_motorway
Restart, or use ComfyUI Manager ("ComfyUI_agilly1989_motorway"). No deps, no models.
The fine print
The pack is an active beta - the README opens "BIG BROKEN WITH ASYNC WILL FIX WHEN I GET THE TIME/MOTIVATION" - and in the version I checked the _motorway_edition clones are commented out of __init__.py; re-enable the ClonedNodeMapping import if the node doesn't show up. Keys are exact and case-sensitive, and the signature error 'MotorwayClass' object has no attribute 'hash_' means you typed a key that isn't in the bus. For a single crop, the plain core CropMask is simpler; this one only earns its keep once you're committed to running masks through the Motorway.
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| MOTORWAY ππ¨ | MOTORWAY ππ¨ | β | |
| INPUT_mask_key | STRING | mask | β |
| x | INT | 00β16384 | β |
| y | INT | 00β16384 | β |
| width | INT | 5121β16384 | β |
| height | INT | 5121β16384 | β |
| OUTPUT_MASK_key | STRING | MASK | β |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| MOTORWAY ππ¨ | MOTORWAY ππ¨ | β |