Resample Mask
Resize a mask without turning its edge into mush
- mask
- scaler
- resampler
- mask
Resample Mask is the mask-flavored twin of Resample Image: same scaler + resampler architecture, but the input and output are MASK tensors instead of IMAGE tensors. You reach for it whenever your mask lives at a different resolution than the thing it's supposed to mask - which happens constantly in ComfyUI, because masks come out of preprocessors, VAE decodes, and other nodes at all sorts of sizes.
The one difference that actually matters: masks are not color, so this node skips the linear-light conversion that Resample Image does. A mask is a scalar intensity field; there's nothing to gamma-correct, and resampling it raw is the right call. That also makes it fast - it's the cheapest node in the pack's resampling family.
How it works
Same plumbing as Resample Image. Three inputs - mask, scaler, and resampler - and one output (mask). The scaler computes the new resolution from the current one, and the resampler does the actual filtering.
Where the filter choice matters more than people expect is on mask edges. If you resize a hard-edged mask down with Resampler | Lanczos, you get ringing - overshoot halos that show up as faint dark or bright fringes where the mask boundary is. For masks, two resamplers dominate:
- Resampler | Nearest-Neighbor - keeps edges pixel-crisp. The right pick for selection-style masks where you want a hard boundary at any size.
- Resampler | Triangle - soft, smooth, no ringing. Right when you actually want the edge softened, e.g. pre-feathering a mask for a gentle composite.
The pack's own inpainting nodes are aware of this: Mask-Crop Inpaint | Pre resizes its composite mask with nearest-neighbor while resampling the image with your chosen filter. That's the correct instinct - an inpaint mask that got bilinear-smudged at the edges leaks gray into the composite and shows up as a seam.
Common issues
The main gotcha is the same one as every node in this pack: the scaler and resampler sockets are required, so an unconnected port throws an error rather than picking a default. And remember masks here are single-channel - if you've got an RGBA image and you're trying to resample its alpha, that's not this node's job; that's Resample Image on a converted alpha, or a dedicated alpha-extraction workflow.
Installing
Same as the rest of the pack - it ships in comfyui-some-image-processing-stuff:
cd ComfyUI/custom_nodes
git clone https://github.com/wmpmiles/comfyui-some-image-processing-stuff
Restart, or install via ComfyUI Manager by searching "Some Image Processing Stuff". No dependencies, no model downloads. It's a small node but it slots directly between a mask source and the inpainting / compositing nodes that need the mask at the right resolution, and it'll save you from the "my inpaint seams look blurry" complaint more than once.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| mask | MASK | — | |
| scaler | SCALER | — | |
| resampler | RESAMPLER | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| mask | MASK | — |