Blockify Mask
Turn any mask into chunky solid blocks
- masks
- mask
Blockify Mask quantizes a mask into solid square blocks. You feed it a MASK and a block_size, and it looks at the region that's actually masked, carves it into a grid of cells that size, and outputs a new mask where every cell that contained any masked pixel is filled in solid. Edges become stair-steps, fine detail gets swallowed, and you end up with a deliberately coarse, pixelated version of your original mask. It's the opposite of a blur - where Mask Blur softens, this chunks.
Inputs:
masks- the MASK input (a batch is fine; it processes each in turn)block_size- an INT from8to512, default32. The size of each block in pixels.
Output is a single mask, the blockified result.
The mechanism, from the source, is satisfyingly concrete: it finds the bounding box of all non-zero pixels, divides that box into a grid where each cell is block_size pixels (or as close as the bbox allows), and uses a scatter-add to count how much masked content lands in each cell. Any cell with content above zero becomes a filled block; empty cells stay empty. Everything outside the original bounding box stays untouched, and the result is clamped to [0,1]. One detail worth noting: it runs on CPU regardless of your GPU, so on very large masks it's slower than the GPU path - fine for masks, just don't feed it a 4K batch and expect instant.
Why would you want a coarser mask? This is where the masking-detection-detailing doc is the right frame: in ComfyUI, masks are how you tell a pass where to work, and the detailers and region-renderers downstream are all "get a mask, do the thing." A blocky mask is a deliberate loss of precision. Common reasons people reach for it:
- Region control: a coarse, low-frequency mask that only roughly marks "this area" is sometimes exactly what a ControlNet or region pass wants - less wobble, fewer stray pixels telling it a single eyelash is a separate region.
- Pixel-art / mosaic effects: chunking a subject mask is the first step in masking a mosaic treatment onto part of an image.
- Cleaning noisy masks: a mask with scattered speckles collapses to a clean set of blocks, which is often easier to reason about.
The honest trade: anything that needed hairline mask precision will fight you here. Blockify is a coarse tool; if you need the seam to hug the subject, this isn't it.
Install is pack standard: ComfyUI Manager → search ComfyUI-Practical-Tools → install → restart, or git clone https://github.com/wenchengxiang/ComfyUI-Practical-Tools into ComfyUI/custom_nodes. No dependencies, no models. If the output looks empty, check that the input mask actually has non-zero pixels - a fully black mask in produces a fully black mask out.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| masks | MASK | — | |
| block_size | INT | 328–512 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| mask | MASK | — |