Nodes/Region Edit Toolkit/图像分区 · 多区域分块规划
ComfyUI Node

图像分区 · 多区域分块规划

The node that chops a big mask into model-sized crops without ever splitting a target

By Liu-Bot24·Created 2 months ago·Updated about a month ago· 1
图像分区 · 多区域分块规划
  • mask
  • plan
  • tile_count
  • ownership_union
  • report_json
max_long_side1536
max_short_side1024
max_pixels1572864
context_pixels192
multiple16
support_threshold0.001
min_component_pixels1
min_target_extent256

The problem this node solves: you want to remove a dozen scattered objects from a 4K image, but your edit model tops out at 1.5 megapixels. The classic answer - just crop each object individually - loses context, and "run the whole image" OOMs. RegionEditTilePlanner is the pack's planner: it takes your target mask and chops it into context-rich generation crops that fit your model, while guaranteeing something worth reading the docs for - the tiles' ownership masks are disjoint and their union exactly equals the planned target mask. No gaps, no overlaps, no target region left unclaimed.

The mechanism: the planner splits your mask into connected components, then, for each component that's too big for the size constraints, carves it into multiple tiles. Every tile gets context_pixels (default 192) of surrounding context so the model can see what's behind and around the object. Each tile tracks two distinct things: its generation crop (mask plus context, what the model sees) and its ownership mask (only the target pixels that tile is responsible for). Because ownership is disjoint and exhaustive, the merge side knows exactly which tile owns each pixel - that's what makes RegionEditTileMerge's seam handling work.

Inputs, the ones a beginner actually sets:

  • max_long_side (1536), max_short_side (1024), max_pixels (1572864) - your model's hard limits. These come straight from RegionEditTileControlPreset in the standard workflow.
  • context_pixels (192) - how much context each crop carries. More context = better inpainting but bigger crops and more VRAM.
  • support_threshold (0.001) - what counts as "in the mask" (dust filter).
  • multiple (16) - sizes snap to multiples of 16, standard for diffusion-friendly dimensions.
  • min_component_pixels (1) and min_target_extent (256) - the planner ignores microscopic specks and won't build tiny near-useless tiles.

Outputs: plan (the REGION_TILE_PLAN that everything downstream consumes), tile_count (handy for a preview readout), ownership_union (a mask proving the union of all ownership equals your target - the planner's own verification), and report_json.

One design nicety worth knowing: the source keeps a SAFE_TILE_MARGIN and a SEAM_GUARD_PIXELS band so that every generation crop deliberately keeps a non-editable rim away from its VAE boundary, and internal ownership seams are generated by at least two tiles. That's the difference between this and a naive grid-crop: it plans for the seams it knows it's going to create, so the seams have a chance of being invisible.

Install: ComfyUI Manager → Region Edit Toolkit (native-region-tile-planner-merge), or git clone https://github.com/Liu-Bot24/ComfyUI-Region-Edit-Toolkit.git into custom_nodes, pip-install requirements.txt into ComfyUI's actual Python, restart. Pure CPU planning - no model, no GPU load; the plan is just data.

Honest note: the plan is a plan, not crops. New users often expect images out of this node and find a custom REGION_TILE_PLAN type instead - that's RegionEditTileBatchPrepare's job. And because this pack is young and quiet, the ownership_union output is your best friend: if you're nervous the planner mis-assigned pixels, that mask shows you exactly what it claimed, and it should match your input mask pixel-for-pixel.

CategoryRegion Edit Toolkit/Tile

Inputs (9)

NameTypeDefaultDescription
maskMASK
max_long_sideINT1536256–16384
max_short_sideINT1024256–16384
max_pixelsINT157286465536–67108864
context_pixelsINT1920–2048
multipleINT161–256
support_thresholdFLOAT0.0010–1
min_component_pixelsINT11–1000000
min_target_extentINT2561–4096

Outputs (4)

NameTypeDescription
planREGION_TILE_PLAN
tile_countINT
ownership_unionMASK
report_jsonSTRING