Image Region To Mask (FS)
Turn a grid cell into a mask without cropping anything
- image
- MASK
This node overlays a grid on your image - however many rows and columns you set - and outputs a mask that's active over exactly one of those cells and empty everywhere else. The README puts it plainly: "this node will turn out a region from an image based on rows and columns." Think of it as the masking sibling to "Crop Image Into Even Pieces": that node physically cuts the grid apart into separate images, this one just marks one cell as a mask and leaves the image untouched.
Why you'd reach for it
Masking a specific region of an image for inpainting normally means either painting it by hand in the mask editor or building it from a detector. If what you actually want is something coarser and reproducible - "mask the top-right third of this image," say, for a fixed layout you're processing over and over - this node gets you there with three numbers instead of a manual paint pass. It's a natural fit ahead of any inpainting node that expects a MASK input.
How it works
Divide the image into a rows × columns grid, then output a mask covering the cell at position (chosen_row, chosen_column). Rows and columns are counts; the chosen position is 0-indexed, so with the default rows: 3, row 0 is the top strip and row 2 is the bottom.
The inputs and outputs that matter
- image (IMAGE) - the image you're building a region mask for.
- rows (INT, default 3, range 1–32) - how many horizontal divisions.
- columns (INT, default 1, range 1–32) - how many vertical divisions.
- chosen_row (INT, default 0, range 0–32) - which row to mask, zero-indexed.
- chosen_column (INT, default 0, range 0–32) - which column to mask, zero-indexed.
Output: MASK - wire it directly into an inpainting setup (a KSampler with a masked latent, or any node expecting a MASK input).
Installing it
ComfyUI Manager: search "Comfy Fit Size" or "fitsize." Manual:
cd ComfyUI/custom_nodes
git clone https://github.com/bronkula/comfyui-fitsize.git
Restart ComfyUI. No models to download, no heavy dependency chain. Lives under Fitsize → Mask once installed - the only node in the pack with its own mask-specific category.
Common issues
The number ranges are worth reading carefully before you set them: rows and columns are counts (how many divisions exist), while chosen_row and chosen_column are zero-indexed positions into that grid - and nothing in the node's ranges stops you from picking a chosen_row or chosen_column that's outside the grid you actually defined (both cap at 32 regardless of your rows/columns setting). If your mask comes out empty, that mismatch - asking for row 3 in a 3-row grid, where the valid rows are 0, 1, and 2 - is the first thing to check.
The general inpainting caveat applies once you're using the mask downstream: whatever region this node marks gets run back through your model, and if your workflow re-decodes the entire canvas through the VAE rather than compositing just the masked region back onto the original pixels, you'll take a small quality hit on the unmasked areas too on every pass. Compositing the result back with something like ImageCompositeMasked, rather than accepting the full VAE round-trip, keeps that from accumulating over repeated inpainting passes.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| rows | INT | 31–32 | — |
| columns | INT | 11–32 | — |
| chosen_row | INT | 00–32 | — |
| chosen_column | INT | 00–32 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| MASK | MASK | — |