Nodes/ComfyUI_EasyRegion/EasyRegion (Mask-Based)
ComfyUI Node

EasyRegion (Mask-Based)

Draw a box, type a prompt, done

By EnragedAntelope·Created 9 months ago·Updated 9 months ago· 2
EasyRegion (Mask-Based)
  • clip
  • conditioning
width1344
height768
soften_maskstrue
background_promptphoto of empty city street at night, high quality
background_strength1.0
region1_promptred sports car
region1_strength0.7
region2_promptcloseup full body giraffe wearing sunglasses
region2_strength0.8
region3_promptblue bird flying
region3_strength1.5
region4_prompt
region4_strength2.5

You ask for "a red sports car on the left, a giraffe on the right," and the model hands you one of them - or both, with their attributes smeared together. That's the classic regional-prompting failure, and the fix has always been to give each part of the canvas its own prompt. The catch is that the plain ComfyUI way to do that is a mini-graph: five CLIP Text Encode nodes, some Conditioning (Set Area) math, masks bolted on top. EasyRegion (Mask-Based) collapses the whole thing into one node with a box-drawing canvas, built for the mask-based model generation: Flux, SD3/SD3.5, Chroma, Qwen-Image.

It's exactly what the name promises: CLIP in, conditioning out, and between those two points you type a background prompt, up to four region prompts, and drag boxes on the canvas. No external text encoders, no conditioning chain to babysit. For a technique that historically means a dozen nodes, this is the version you'll actually keep installed.

How it works

The interesting part is the attention masking. Each region prompt gets CLIP-encoded like normal, and the background prompt is quietly prepended to every region so they all share scene context - that's what keeps it from looking like three stickers pasted on a photo. Then the node builds a binary mask (feathered at the edges when soften_masks is on) and, crucially, a strict attention mask that blocks the model from attending across region boundaries.

That last bit is the whole game. Without it, "bird in the top-right box" renders a bird in the center of the frame because that's where birds naturally go, and your box ends up empty. The attention mask forces the bird pixels to exist only inside the bird box. The trade-off is that regions become less aware of each other, which is why the per-region strength dials exist - you're balancing placement against cohesion.

The inputs that matter

  • clip - from your checkpoint, same as any text encoder.
  • width / height - must match your latent exactly, and stay multiples of 64.
  • soften_masks - edge feathering; the tooltip says recommended ON, and it is.
  • background_prompt / background_strength - the scene. Lower background strength (the tooltip's user-tested band is 0.7–1.2) and the regions show more.
  • region1–4_prompt / region1–4_strength - per-box content and intensity.

The box geometry lives on the canvas: a region selector plus box_x, box_y, box_w, box_h. The single output is conditioning, which wires straight into your sampler's positive input. One honesty note: the README's generic advice ("start with strength 2.5–4.5") is older than what ships now - the defaults are 0.7 / 0.8 / 1.5 / 2.5 and the per-field tooltips are the current calibration. Trust the tooltips.

Install

Same as the whole pack - either ComfyUI Manager (search ComfyUI_EasyRegion) or:

cd ComfyUI/custom_nodes
git clone https://github.com/EnragedAntelope/ComfyUI_EasyRegion

Then restart ComfyUI. There's no requirements.txt and no model download - it uses the CLIP from your existing checkpoint, pure Python plus torch you already have. The one real requirement is a reasonably recent ComfyUI: the attention masking needs the attention_mask_img_shape API that landed around version 0.3.71.

Troubleshooting

  • Regions not showing: raise the region's strength, lower background_strength, and double-check width/height match your latent exactly. Keep boxes apart - overlapping or touching regions compete.
  • Soft or blurry regions: strength too high. The sweet spot per the tooltips is roughly 0.5–1.0 for region 1, creeping up to 2.5–3.0 for region 4.
  • KeyError: 'attention_mask_img_shape': your ComfyUI predates the attention-mask API - update it.
  • Flux: CFG 1.0 and no negative prompt; higher CFG just blurs. And stick to 3–4 regions max - more than that and the pack itself warns most models fall apart.
CategoryEasyRegion

Inputs (14)

NameTypeDefaultDescription
clipCLIPCLIP model from your checkpoint
widthINT134464–16384Output width - must match your latent/sampler
heightINT76864–16384Output height - must match your latent/sampler
soften_masksBOOLEANtrueEnable feathering at region edges - recommended ON
background_promptSTRINGphoto of empty city street at night, high qualityScene description (applies to entire image as base)
background_strengthoptFLOAT1.00–10Background conditioning strength (lower = regions show more, user-tested: 0.7-1.2)
region1_promptoptSTRINGred sports carRegion 1 - TIP: Include size/detail keywords (e.g. 'closeup', 'full body', 'large')
region1_strengthoptFLOAT0.70–10Region 1 strength (user-tested: 0.7, range: 0.5-1.0)
region2_promptoptSTRINGcloseup full body giraffe wearing sunglassesRegion 2 - TIP: Include size/detail keywords (e.g. 'closeup', 'full body', 'large')
region2_strengthoptFLOAT0.80–10Region 2 strength (user-tested: 0.8, range: 0.6-1.2)
region3_promptoptSTRINGblue bird flyingRegion 3 - Optional third region
region3_strengthoptFLOAT1.50–10Region 3 strength (user-tested: 1.5, range: 1.0-2.0)
region4_promptoptSTRINGRegion 4 - Optional fourth region
region4_strengthoptFLOAT2.50–10Region 4 strength (recommended: 2.5-3.0, higher values may cause artifacts)

Outputs (1)

NameTypeDescription
conditioningCONDITIONING