🔳Crop (OreX)
An interactive crop box that remembers your output size
- image
- mask
- image
- mask
- width
- height
Most crop nodes in ComfyUI are blunt instruments: pick pixel offsets, pray you guessed right. Crop (OreX) is the one with a canvas UI - you drag a crop box directly on the preview and the node cuts exactly what you selected. That alone would justify it for anyone doing manual region work, but it goes further: after cropping it can resize the result to a target size or megapixel budget, and it crops your mask alongside the image. It's the node for "I need this exact region, at this exact output size, without it looking mangled."
How it works
The inputs are percentages, not pixels: crop_left, crop_right, crop_top, crop_bottom each take 0–100 (percent of the image dimension), so your crop survives image resolution changes. The bundled JS gives you the interactive drag box; the node converts your percentages to pixel slices, cuts the tensor, and then applies a smart resize:
- If
resolution (MP)is set, it rescales to that megapixel budget while preserving the crop's aspect ratio. - Otherwise it uses
width/height- but with a guard against the classic "stale widget" bug: if the ratio your widgets suggest is more than 2% off from the crop's actual ratio, it assumes the widgets are leftovers from a previous image and keeps the crop's real dimensions instead of stretching your subject into a pancake. - Results are snapped to
multiplicity(16 by default) so downstream samplers don't complain.
upscale_method (nearest/bilinear/bicubic/area/lanczos) picks the resampling, and ratio_lock forces an aspect ratio when you drag. Give it a mask and you get the same region cut from the mask, resized to match - so you can crop an image and its mask in lockstep for inpainting or compositing.
Outputs
image (the cropped, resized tensor), mask (the cropped mask - ones-filled if none was supplied), and width / height of the final crop. It's marked as an output node, so it also posts a preview of the crop to the UI.
Install
ComfyUI Manager (search "comfyui-OreX") or:
cd ComfyUI/custom_nodes
git clone https://github.com/orex2121/comfyui-OreX
Restart. No extra dependencies or model files - it's PIL + torch.
Where people get tripped up
The percent-based inputs trip up the first crop: crop_right measures from the right edge inward, so a crop_right of 10 cuts the rightmost 10% off, and same for crop_bottom. If you leave all four at 0 you get the full image resized to width/height, which is a valid (if accidental) resize workflow. And the resolution guard means widgets are sometimes ignored on first run - that's the node protecting you, not misbehaving; set resolution (MP) if you want deterministic control over the output size instead.
Inputs (13)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| crop_left | FLOAT | 0.00–100 | — |
| crop_right | FLOAT | 0.00–100 | — |
| crop_top | FLOAT | 0.00–100 | — |
| crop_bottom | FLOAT | 0.00–100 | — |
| widthopt | INT | 5120–16384 | — |
| heightopt | INT | 5120–16384 | — |
| multiplicityopt | INT | 161–64 | — |
| resolution (MP)opt | FLOAT | 0.000–100 | — |
| upscale_methodopt | COMBO | bicubic | 5 options: nearest-exact, bilinear, area, bicubic, lanczos |
| aspect_ratioopt | STRING | Custom | — |
| ratio_lockopt | BOOLEAN | false | — |
| maskopt | MASK | — |
Outputs (4)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |
| mask | MASK | — |
| width | INT | — |
| height | INT | — |