Nodes/Prompt Helpers/EZ Mask Regions
ComfyUI Node

EZ Mask Regions

Give your JSON prompt real masks to reference by name

By Pauan·Created 8 months ago·Updated 5 months ago· 3
EZ Mask Regions
  • prompt
  • masks
  • PROMPT
names

EZ Mask Regions is how the Prompt Helpers pack connects real, painted or detected masks to your JSON prompt. The pack's prompt format can mark a chunk as belonging to a region - either a rectangle (region:) or a named mask (mask-region: name). Rectangles are easy: they're just numbers in the JSON. Masks need actual mask tensors, and those live on the canvas, not in a text file. This node is the bridge.

Three inputs:

  • prompt (EZ_PROMPT_SETTINGS) - the prompt settings bundle from EZ Prompt.
  • masks (MASK) - one or more mask tensors. This is a list-capable socket, so you can feed several masks at once (from mask-drawing nodes, segmentation/detection nodes, or saved masks).
  • names (STRING) - the names for those masks, in the same order. Whatever you type here is what your JSON refers to with mask-region: name.

The output is PROMPT (EZ_PROMPT_SETTINGS), the same prompt bundle now carrying a name→mask mapping - wired into EZ Generate.

How it works

EZ Mask Regions merges each name/mask pair into the prompt settings' mask table. At generation time, when EZ Generate's parser hits mask-region: face in your JSON, it looks up "face" in that table, grabs the mask tensor, and applies it with ConditioningSetMask - the same mechanics as classic regional conditioning, just driven by a name lookup instead of a hardwired wire. If the JSON references a mask name that was never registered, you get a clear error naming the missing region.

The pairing is positional by design: each entry in names matches the mask at the same index, one-to-one (face → mask[0], hands → mask[1]). When you feed multiple masks, give the node an equal number of names in the same order - the pack pairs them up by position rather than by any parsing of the string.

The workflow shape

Mask nodes ──► EZ Mask Regions ─┐
                                ├─► EZ Generate
EZ Prompt ──────────────────────┘

The prompt text is where the intent lives: MASK-REGION: face in your JSON means "the following chunk only affects the face," with per-region strength and isolated options. This is the pack's take on the detailing/regional-conditioning pattern - you get the mask from wherever you like (hand-painted, a detector like face YOLO, whatever), and the JSON keeps the prompt logic tidy and reusable. It's the manual-mask counterpart to EZ Crop's rectangle regions: Crop for boxes, Mask Regions for anything with a shape.

Installing it

It ships with the Prompt Helpers pack. In ComfyUI Manager search "Prompt Helpers" (Pauan/comfyui-prompt-helpers), install, restart. Manual:

cd ComfyUI/custom_nodes
git clone https://github.com/Pauan/comfyui-prompt-helpers

Restart ComfyUI. No model downloads; the pack needs PyYAML and desktop-notifier and ComfyUI 0.8.0+.

The failure mode people hit first is a name mismatch - the names string says face but the JSON says MASK-REGION: Face, and nothing happens (or you get the missing-region error). Case and spelling must match exactly. Second place: feeding masks and names out of order, which silently applies the wrong mask to the wrong name. Check the mapping before you blame the sampler.

Categoryprompt_helpers/prompt

Inputs (3)

NameTypeDefaultDescription
promptEZ_PROMPT_SETTINGS
masksMASKList of masks.
namesSTRINGNames of the masks, in the same order as the masks.

Outputs (1)

NameTypeDescription
PROMPTEZ_PROMPT_SETTINGS