Cut For Inpaint
Stop feeding your whole 4K image through the model for a small fix
- image
- mask
- image
- mask
- origin
The problem this solves is exactly as described in the README: "When you work with big image and your inpaint mask is small it is better to cut part of the image, work with it and then blend it back." If your source image is huge and the thing you're fixing is a small region - a face, a logo, a stray artifact - running the entire frame through BrushNet or PowerPaint wastes VRAM and time, and the model spends most of its attention on pixels you don't even care about. Cut For Inpaint crops just the region around your mask, at a size you choose, so the model gets to work on the actual problem at a sensible resolution.
How it works
It crops a fixed-size window from your image and mask around the masked region, and - importantly - it also records exactly where that crop came from. That position data is what lets you paste the result back precisely afterward, rather than eyeballing it.
Inputs and outputs
width/height(default 512 each, range 64–2048) - the size of the crop. Set these to whatever resolution your inpainting model is comfortable at - 512 for SD1.5, higher for SDXL. Make sure the crop is generous enough to fully contain your mask with some padding around it; a crop that hugs the mask boundary too tightly starves the model of the surrounding context it needs to blend the result convincingly.image/mask- your full-size source image and mask.
Outputs: image and mask (the cropped versions, ready to feed into BrushNet or PowerPaint), and origin - a VECTOR recording the crop's position. That last one is the piece that makes the whole workflow work: it's designed to feed directly into Blend Inpaint's optional origin input, so the inpainted crop lands back in exactly the right spot in the full-size image.
The three-node chain
This node is one third of the pack's answer to big-image inpainting, and it's meant to be used as a set: Cut For Inpaint crops the region → BrushNet (or PowerPaint) inpaints just that crop → Blend Inpaint composites the result back into the original using the origin vector. The README's own "Big image inpaint" example walks through exactly this chain.
Installing it
Bundled with the whole pack, no separate install. ComfyUI Manager: search "BrushNet," install, restart. Manually: cd ComfyUI/custom_nodes && git clone https://github.com/nullquant/ComfyUI-BrushNet && pip install -r requirements.txt. This node itself needs no model downloads - it's pure image cropping, not a network - but you'll need BrushNet or PowerPaint checkpoints installed for the rest of the chain to do anything.
Common issues
Crop too tight around the mask. If width/height barely cover the masked area, the model loses the surrounding context it needs and the blend at the edges can look off even after Blend Inpaint softens the seam. Give yourself real padding - the general inpainting-community rule of thumb for "only masked" crops is 32-64px of breathing room around the edit, and the same logic applies here.
Forgetting to wire origin downstream. The origin output only matters if you actually connect it to Blend Inpaint's origin input. Skip that wire and Blend Inpaint has no way to know where your crop belongs in the full image - you'll need to handle placement yourself, which defeats the point of using this node in the first place.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| mask | MASK | — | |
| width | INT | 51264–2048 | — |
| height | INT | 51264–2048 | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |
| mask | MASK | — |
| origin | VECTOR | — |