ComfyUI Node
Mask Crop
Cuts the painted area out of a picture with room to spare, in a size a sampler will accept. pad_* are multipliers of the painted area's short side, so 1.4 adds 40% of it on that side and 1.0 hugs the paint. size_mode native keeps the composed size, square pads it out to a square, custom frames it to custom_width x custom_height (0 on one side derives it from the other). multiple rounds the result up to a whole number (8 keeps latent sizes legal). Whatever still hangs outside the picture is filled from its own edge colours. Feed the seam output to Crop Restore to paste a processed crop back in place.
Mask Crop
- image
- mask
- seam
- image
- mask
◄size_modenative►
◄custom_width1024►
◄custom_height1024►
◄multiple8►
◄pad_top1.40►
◄pad_right1.40►
◄pad_bottom1.40►
◄pad_left1.40►
◄fill_holesfalse►
◄filledge►
CategoryQG-tools/Mask
Inputs (12)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | The picture to cut from. | |
| mask | MASK | What to keep in frame. The whole batch shares the union of every frame's painted area. | |
| size_mode | COMBO | native | native: the composed size. square: padded out to a square. custom: framed to the size below. |
| custom_width | INT | 10240–8192 | custom only. 0 means derive it from custom_height and the composed aspect. |
| custom_height | INT | 10240–8192 | custom only. 0 means derive it from custom_width and the composed aspect. |
| multiple | INT | 81–256 | Round the crop up to a whole multiple of this. 8 keeps latent sizes legal; 1 disables it. |
| pad_top | FLOAT | 1.401–4 | Room above the paint, as a multiplier of its short side. 1.0 hugs it. |
| pad_right | FLOAT | 1.401–4 | Room to the right, same unit. |
| pad_bottom | FLOAT | 1.401–4 | Room below, same unit. |
| pad_left | FLOAT | 1.401–4 | Room to the left, same unit. |
| fill_holes | BOOLEAN | false | Fill the gaps the paint closes all the way round before measuring it, so a bracelet or a window does not shrink the frame. |
| fill | COMBO | edge | How the room outside the picture gets painted: edge takes each side's most common colour, stretch repeats its outer row or column, black leaves it empty. |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| seam | QGSeam | Everything Crop Restore needs to put the result back: the source picture, the rectangle and the size it was cut at. |
| image | IMAGE | The crop, ready for an upscale or a repaint. |
| mask | MASK | The same crop's mask. Empty where the crop reaches outside the picture. |