Nodes/ComfyUI-YogurtNodes/Mask Region Planner (Yogurt Nodes)
ComfyUI Node

Mask Region Planner (Yogurt Nodes)

Plan crop-first repaint tiles so you don't regenerate the whole image

By yogurt7771·Created 2 years ago·Updated 9 days ago· 1
Mask Region Planner (Yogurt Nodes)
  • image
  • masks
  • region_info
  • preview
tile_width512
tile_height512
context_padding32
edit_grow8
blend_expand8
blend_feather8
multiple_of8
merge_distance64
max_waste_ratio1.00
threshold0.50

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_ratio limits 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.

CategoryYogurtNodes/Masks

Inputs (12)

NameTypeDefaultDescription
imageIMAGEOriginal image used for size and preview.
masksMASKSplit mask batch.
tile_widthINT5128–16384
tile_heightINT5128–16384
context_paddingINT320–4096
edit_growINT80–1024
blend_expandINT80–1024
blend_featherINT80–1024
multiple_ofINT81–1024
merge_distanceINT640–4096Tie-break hint for merge order. Regions merge whenever their required safe boxes fit one tile.
max_waste_ratioFLOAT1.000–1
thresholdFLOAT0.500–1

Outputs (2)

NameTypeDescription
region_infoDICT
previewIMAGE