Image Crop (RMBG) 🖼️
Crop by size and anchor, and keep the leftover
- image
- CROP
- REST
Crop a region out of an image by size and position, and - the part that makes this node worth reaching for - get the rest of the image back too. Most crop nodes throw away everything outside the crop. This one gives you both the crop and the remainder as separate outputs, which is exactly what you want when you're going to edit the cropped part and paste it back.
That two-output design is the whole reason to pick this over the built-in crop. Cut out a face, run it through a detailer or an edit model, then recombine it with the untouched remainder. The node keeps both halves so the recombine is possible without a second pass to reconstruct what you cut.
How it works
You set a crop size (width × height) and tell it where to anchor, either by a named position or by nudging with pixel offsets. It slices out that rectangle as CROP and returns everything else as REST.
The inputs that matter
widthandheight- the size of the crop rectangle.position- a nine-way anchor:top-left,top-center,top-right, the center row, and the bottom row. This is the fast way to say "crop the top-right corner" without doing offset math.x_offsetandy_offset- fine positioning on top of the anchor. Positive/negative pixel nudges when the anchor gets you close but not exact.split(default off) - toggles the split behavior for how the crop and remainder are divided. Leave off for a normal crop-plus-rest.
Outputs are CROP (the cut-out region) and REST (everything outside it). Send CROP into your editing chain, hold REST, and recombine at the end.
How to install it
- ComfyUI Manager: search
Comfyui-RMBG, install, restart. - Manual:
cd ComfyUI/custom_nodes && git clone https://github.com/1038lab/ComfyUI-RMBG, thenpip install -r requirements.txt, and restart.
No model - a plain image op, live as soon as the pack loads.
Common issues
The main thing to watch is a crop that runs off the edge of the image. If your width/height plus the anchor and offsets push the rectangle past the image bounds, you'll get a smaller or oddly-positioned crop than you expected. Keep the crop size within the source dimensions, and use position to anchor first before reaching for offsets - the named anchors are clamped sensibly, whereas large manual offsets are the fast way to slide the crop somewhere you didn't mean. If you're recombining CROP and REST later and the seam is off, make sure nothing resized the crop in between; the two halves only line back up at their original scale.
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| width | INT | 2560–16384 | Width of the crop region in pixels. Will be clamped to image width. |
| height | INT | 2560–16384 | Height of the crop region in pixels. Will be clamped to image height. |
| x_offset | INT | 0 | Horizontal offset (in pixels) added to the crop position. Positive values move right, negative left. |
| y_offset | INT | 0 | Vertical offset (in pixels) added to the crop position. Positive values move down, negative up. |
| split | BOOLEAN | false | If True, output the cropped region and the rest of the image with the crop area set to zero. If False, the rest is a zero image. |
| position | COMBO | Anchor position for the crop region. Determines where the crop is placed relative to the image. |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| CROP | IMAGE | — |
| REST | IMAGE | — |