Mask Region Planner (Yogurt Nodes)
Plan crop-first repaint tiles so you don't regenerate the whole image
- image
- masks
- region_info
- preview
The fastest way to destroy a good image is to repaint the whole thing to fix one 64px problem. The correct way - the one the inpainting community has converged on, and the reason crop-and-stitch patterns beat whole-frame regeneration - is to crop around the problem, regenerate that tile at high resolution, and paste it back so every unmasked pixel stays byte-identical. YogurtMaskRegionPlanner is the node that plans those tiles for you.
It's part of ComfyUI-YogurtNodes, yogurt7771's 150+ node all-in-one pack - obscure, MIT-licensed, auto-generated README - and it sits in the pack's mask section, which is one of its more interesting corners. It's a planner, not an executor: it takes split masks and produces the region map the rest of the pipeline uses.
How it fits together
The pack's repaint chain is: Split Mask (turns a combined mask into one batch item per connected component) → this node (plans fixed-size tiles for each component) → Crop Image By Regions (crops image + mask batches for each tile) → your repaint step → Composite Repaint Regions (stitches everything back). Preview Repaint Regions draws the boxes so you can see the plan before you run anything.
The philosophy is straight out of the crop-edit-stitch playbook: give the model the region at native resolution with enough surrounding context to blend, and leave the rest of the frame alone.
The inputs that matter
Two data inputs: image (the original, used for size and preview) and masks (the split mask batch from Split Mask). Then a wall of knobs, of which a beginner mostly needs these:
tile_width/tile_height- the fixed tile size, default 512. Match this to your model's native resolution (1024 for SDXL/Flux-era work).context_padding- pixels of context around the edit region, default 32. This is the "let the model see what's around it" buffer; inpainting best practice lands in the 32–64px range.threshold- the mask value above which a pixel counts as part of a region, default 0.5.edit_grow,blend_expand,blend_feather- defaults 8/8/8: how much the editable area grows beyond the mask, how far blending extends, and how soft the seam feather is.multiple_of- tiles snap to a multiple of this (8), keeping dimensions model-friendly.merge_distance- a tie-break hint: regions merge when their required safe boxes fit one tile.max_waste_ratiolimits how much empty tile you tolerate.
Two outputs: region_info (a DICT describing the planned tiles - feed it to Crop Image By Regions) and preview (the image with planned boxes drawn, so you can eyeball the plan).
Where you'll use it
- Detail fixes - faces, hands, background clutter - that deserve full-resolution repaint attention without a whole-image pass.
- Anything where unmasked pixels must stay untouched, which is exactly the case masks still own over instruction-editing models.
Install
ComfyUI Manager, search ComfyUI-YogurtNodes, install, restart. Or:
cd ComfyUI/custom_nodes
git clone https://github.com/yogurt7771/ComfyUI-YogurtNodes
cd ComfyUI-YogurtNodes
pip install -r requirements.txt
Restart, look under "Yogurt Nodes". No model downloads - the repaint model is whatever you're already sampling with. Start from the defaults and only touch tile_width/tile_height and context_padding until the previews tell you otherwise; this node has a lot of knobs, but it behaves sensibly at its defaults.
Inputs (12)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | Original image used for size and preview. | |
| masks | MASK | Split mask batch. | |
| tile_width | INT | 5128–16384 | — |
| tile_height | INT | 5128–16384 | — |
| context_padding | INT | 320–4096 | — |
| edit_grow | INT | 80–1024 | — |
| blend_expand | INT | 80–1024 | — |
| blend_feather | INT | 80–1024 | — |
| multiple_of | INT | 81–1024 | — |
| merge_distance | INT | 640–4096 | Tie-break hint for merge order. Regions merge whenever their required safe boxes fit one tile. |
| max_waste_ratio | FLOAT | 1.000–1 | — |
| threshold | FLOAT | 0.500–1 | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| region_info | DICT | — |
| preview | IMAGE | — |