Cut (Inpaint Segments)
Give a 64-pixel face the whole 1024 budget
- image
- mask
- mask_mapping_optional
- cut image
- cut mask
- region
A face occupying 64 pixels of a 1024×1024 frame gets 64 pixels worth of model attention, and it comes out mush. The fix that every serious inpainter converges on is brutally simple: crop the tiny region, regenerate it at full resolution, paste it back. Cut (Inpaint Segments) is the crop half of that trick, and it's the node that makes the whole thing feel automatic.
What it does
You feed it an image and a mask, and it does three things per mask region: finds the bounding box of each blob, crops the image to that box (with a little padding of context around it), and resizes the crop to a working size - force_resize_width / force_resize_height, both defaulting to 1024. What comes out is a region that occupies the model's full generation budget instead of a corner of it.
The crop sizing is where the defaults stop being enough, which is why the inputs look intimidating:
constraintsandconstraint_x/constraint_y-multiple_ofsnaps each crop to a multiple of your model's native resolution (64 for SDXL, 8 or 16 for Flux).keep_ratioandkeep_ratio_divisiblehold aspect instead.min_width/min_height- a floor so a 12-pixel spec of dust doesn't get blown up into a 1024 blur.batch_behavior-match_sizeforces every crop to the same pixel size (good for a consistent batch),match_ratiomatches aspect ratios instead.kind- whether the output ismask,RGB, orRGBA. Leave RGB unless you need the alpha.
The outputs and the wiring
It returns three things: cut image (your crops, ready for the sampler), cut mask (the per-crop mask), and region (the geometry that lets Paste put everything back). The intended chain, which the pack ships as a basic workflow, is:
LoadImage → Mask Ops → Cut (Inpaint Segments) → KSampler → VAE Decode → Paste (Combine and Paste) → Preview
One gotcha the schema hides: this node's mask input is an IMAGE, not a MASK. You can't drag a MASK wire straight into it - feed it the mask_image output from Mask Ops, or whatever image form of the mask you have.
Installing it
It lives in ComfyUI-I2I-slim, GeraldWie's lean fork of ManglerFTW's ComfyI2I. ComfyUI Manager:
Manager → Install Custom Nodes → search "ComfyUI-I2I-slim" → Install → Restart
or by hand:
cd ComfyUI/custom_nodes
git clone https://github.com/GeraldWie/ComfyUI-I2I-slim
cd ComfyUI-I2I-slim
pip install -r requirements.txt
No model downloads. Be aware the requirements file lists tensorflow and scikit-image that the code never imports - the real runtime deps are numpy, torch, torchvision, opencv and PIL, so don't feel obliged to install the whole list.
Common issues
- Crops come out the wrong shape or resolution - that's
constraintsdoing its thing. If you want plain crops, set it toignore. - Fixing small details with no context - the inpainting playbook says give detail fixes 32-64px of padding. This node's
paddingis in pixels and defaults small, so bump it when the regenerated region is missing the surrounding context it needs to blend. - Cut produces something useless with an empty mask - an all-black mask has no bounding box to crop. Make sure your mask has actual white regions.
- Batch size mismatch downstream - if Paste complains about a missing entry for a mask index, you generated fewer images than there are regions; check your sampler's batch count.
The name says "segments" and that's the point: one mask, many regions, each edited at full resolution and stitched back. For the crop-and-stitch inpainting pattern, this is the crop.
Inputs (13)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| mask | IMAGE | — | |
| force_resize_width | INT | 10240–1048576 | — |
| force_resize_height | INT | 10240–1048576 | — |
| kind | COMBO | 3 options: mask, RGB, RGBA | |
| padding | INT | 30–1048576 | — |
| constraints | COMBO | 4 options: keep_ratio, keep_ratio_divisible, multiple_of, ignore | |
| constraint_x | INT | 642–1048576 | — |
| constraint_y | INT | 642–1048576 | — |
| min_width | INT | 00–1048576 | — |
| min_height | INT | 00–1048576 | — |
| batch_behavior | COMBO | 2 options: match_ratio, match_size | |
| mask_mapping_optionalopt | MASK_MAPPING | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| cut image | IMAGE | — |
| cut mask | IMAGE | — |
| region | IMAGE | — |