Mask Rect Area
A rectangular mask defined by percentages
- MASK
Sometimes you don't need a detector or a paint tool - you just need a box. Mask Rect Area makes a rectangular mask from four numbers, and the clever part is they're percentages, not pixels. Set width to 50 and you get a rectangle half the image wide, whatever the resolution. That means the same node produces the right mask on a 512px preview and a 2048px final without touching a slider, which is why it's handy for masks you want to stay proportional across a workflow.
It comes with a little preview canvas so you can see the rectangle you're describing, which beats guessing at numbers and re-running.
How it works
You give it a position and a size as percentages of the image, and it fills that rectangle white on a black background. Because everything is relative (0–100), the mask scales with whatever it's applied to instead of being pinned to a pixel grid. Optionally it blurs the edges so the rectangle isn't a hard cut.
The inputs and outputs that matter
All values are percentages from 0 to 100:
x/y- the top-left corner of the rectangle, as a percentage across and down the image.width/height- the size of the rectangle, again as a percentage of the image dimensions. Defaults are 50/50, i.e. a box a quarter of the total area sitting in the top-left.blur_radius(default0) - softens the edges. Leave it at 0 for a crisp rectangle; raise it to feather the boundary so a downstream inpaint blends instead of leaving a seam.
The single output is MASK, which goes wherever a mask is expected - an inpaint, a detailer, a composite, or into a mask operation like subtract or combine.
How to install it
Part of the Impact Pack. ComfyUI Manager: search ComfyUI Impact Pack, Install, restart. Manually:
cd ComfyUI/custom_nodes
git clone https://github.com/ltdrdata/ComfyUI-Impact-Pack comfyui-impact-pack
cd comfyui-impact-pack
pip install -r requirements.txt
then restart. No models needed - it draws a rectangle.
Common issues & troubleshooting
The rectangle is in the wrong spot or the wrong size. Remember these are percentages, not pixels. x/y place the corner, and width/height grow from there - so x: 90, width: 50 runs off the right edge. Watch the preview canvas as you tweak.
You need exact pixel coordinates instead. Percentages are great for proportional masks but useless when you need "a 256x320 box at pixel (40, 40)." For that, use the sibling node Mask Rect Area (Advanced), which takes pixel values plus an explicit image size.
The masked edge is too hard for inpainting. Bump blur_radius up a few pixels so the boundary feathers, or run the output through a Gaussian Blur Mask node. A hard rectangular edge tends to leave a visible seam wherever the masked pass meets the original.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| x | INT | 00–100 | — |
| y | INT | 00–100 | — |
| width | INT | 500–100 | — |
| height | INT | 500–100 | — |
| blur_radius | INT | 0 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| MASK | MASK | — |