Cut Image By Mask
Crop straight to the region you actually care about
- image
- mask
- image
Take an image and a mask, get back just the region the mask covers. That's the whole job - no detection, no model, no sampling. It's the "crop" half of a pattern you've almost certainly used before without thinking about it: detect a region, crop it out, do something to it at full resolution, paste it back. Impact Pack's FaceDetailer runs exactly this loop automatically for faces (detect → crop → resample → composite). This node, together with its two siblings in the same pack - SquareMaskRegion and PasteImageByMask - gives you the manual, build-it-yourself version of that same idea, usable on any region a mask can describe, not just faces.
Why bother with the manual version when Impact Pack already automates it? Control. A detailer node picks the region for you off a detector model. Here, the mask can come from anywhere - hand-painted, output from a segmentation node, a face/hand detector, whatever you've already got wired up - and once you have it, SquareMaskRegion can square it off with padding, this node cuts it out, and PasteImageByMask composites the processed result back in with a feathered edge. Three small nodes instead of one big one, but you control every step.
Inputs and output
Just two required inputs, nothing optional:
image- the source image.mask- the mask defining the region to cut. Anything that produces aMASKoutput works: manual paint masks, SAM, a detector's bbox mask, whatever's upstream.
The output is a single image - the cropped region. From here it typically goes straight into whatever processing you actually wanted to run on it (a sampler, an upscaler, an image-editing model) before eventually going into PasteImageByMask to land it back on the original.
Installing it
ComfyUI Manager: search ComfyUI-load-lora-from-url. Manual install:
cd ComfyUI/custom_nodes
git clone https://github.com/bollerdominik/ComfyUI-load-lora-from-url
Restart ComfyUI. Nothing to download for this node - it's pure image math, no model weights involved.
Where people get burned
Since this pack ships with no documentation beyond the node itself, most of the friction here is generic "working with masks" friction rather than anything specific to this node:
- Empty or all-zero masks. If your upstream mask generator failed silently (a detector finding nothing, a threshold set wrong), you're feeding this node a mask that covers nothing, and the crop it hands back will be equally useless. Worth a quick preview-image check on the mask itself before it reaches this node, especially in a workflow you're not actively watching run.
- Mismatched image and mask dimensions. If the mask came from a different resolution than the image you're cutting from, expect the region to land in the wrong place or the node to complain. Keep mask and image the same size all the way through the chain.
- Forgetting the crop is meant to go somewhere. On its own this node just makes a smaller image - it's only useful as one leg of the cut → process → paste pattern. If you don't already have a plan for what happens to the cropped piece, you probably want a full auto-detailer node instead of assembling the pieces by hand.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| mask | MASK | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |