AC_Super_MaskScale
Resize a mask to exact pixel dimensions
- mask
- IMAGE
- MASK
AC_Super_MaskScale resizes a mask to an exact width and height. Masks come in all sorts of sizes from different sources - a detected face, a segmentation output, a hand-painted region - and when you need one to line up with an image at a specific resolution, this is the node that gets it there.
How it works
Internally it treats the mask as an image. A mask tensor is single-channel, so the node reshapes it into a 3-channel image, runs it through comfy.utils.common_upscale to your target width and height, then pulls the chosen channel back out as the mask. That's why it returns two things: the upscaled IMAGE and the MASK, so you can use whichever form your next node wants.
The inputs that matter
mask- the input mask.upscale_method-nearest-exact,bilinear,area,bicubic, orlanczos. This one matters more than people expect:nearest-exactkeeps mask edges hard and pixel-crisp (right for cutting), whilebilinear/bicubicfeather and soften them (useful when you want a gentle edge).areais a good default for downscaling.width/height- target dimensions, 0 to 5277. Here's the trick: set one of them to 0 and it's computed from the other to preserve the aspect ratio. Sowidth=1024, height=0scales a 512×768 mask to 1024×1536 automatically.crop-disabledorcenter. If the source aspect ratio doesn't match your target,centercrops the excess from the middle;disabledsquishes it.channel- red/green/blue/alpha. Masks are single-channel, and since the node duplicated that one channel into three, they're all identical -redis fine unless you specifically built a multi-channel image.
The outputs
IMAGE (the upscaled mask as a visual image) and MASK (the same thing back as a mask). Wire the MASK into an inpaint/denoise node, a composite, or a preview.
Installing it
Part of ComfyUI_AC_FUNV8Beta1 by Cc啊程 (Bilibili ComfyUI teacher; README is Chinese). ComfyUI Manager (search "AC_FUN") or:
cd ComfyUI/custom_nodes
git clone https://github.com/A719689614/ComfyUI_AC_FUNV8Beta1
Restart ComfyUI. No downloads.
Where people get burned
The aspect-ratio autoscale is the feature most people miss because the widgets default to 512×512 - set both nonzero and you'll just squash your mask into a square. Let one side be 0 to keep proportions. And don't reach for this node expecting detail restoration: upscaling a mask is pure geometry, it can't invent cleaner edges than the source had. If your mask is rough, clean it before scaling, not after.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| mask | MASK | — | |
| upscale_method | COMBO | 5 options: nearest-exact, bilinear, area, bicubic, lanczos | |
| width | INT | 5120–5277 | — |
| height | INT | 5120–5277 | — |
| crop | COMBO | 2 options: disabled, center | |
| channel | COMBO | 4 options: red, green, blue, alpha |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |
| MASK | MASK | — |