ComfyUI Node

Region Mask

Paint your region instead of typing coordinates

By attashe·Created 2 years ago·Updated about a year ago· 142
Region Mask
  • mask
  • condition
  • REGION

FluxRegionMask is the freeform sibling of FluxRegionBBOX. Where the bbox node hands RegionAttention a rectangle, this one hands it a mask you actually painted. Rectangles can't draw a person, and they certainly can't draw a person mid-gesture - if your region is an organic shape, a subject, a prop, or a slice of background, this is the node you want.

The inputs are exactly two: mask (a MASK) and condition (the region prompt's CONDITIONING). Draw the mask in ComfyUI's MaskEditor or anywhere else a MASK comes from, encode the region's own prompt with a ClipTextEncodeFlux, and out the other end comes a REGION ready for RegionAttention's region1 through region4.

A couple of mechanical details are worth knowing before they bite you. First, the pack treats the mask as binary at 0.5: the attention logic only counts mask values above 0.5 as "inside the region". So a soft, feathered mask is effectively cut clean at the 0.5 threshold - if you want a soft boundary, this isn't the tool for it. Paint in hard white where the region should be, black everywhere else. Second, the mask gets resized to the generation size and then downsampled to latent resolution, so a mask drawn at one aspect ratio gets stretched to match your target. Draw your mask on a canvas that matches your output resolution, or your carefully painted subject will come out squeezed.

Same story with condition as the bbox node: encode just the region's prompt - "a red fox", "a neon sign" - not the whole scene. The main prompt for the overall image lives elsewhere, in the conditioning you feed RegionAttention directly. That's the design of the pack: a base prompt sets the background and style, and each region contributes its own subject.

Installation is the same shared block, since all four nodes ship in one pack:

cd ComfyUI/custom_nodes
git clone https://github.com/attashe/ComfyUI-FluxRegionAttention

then restart ComfyUI - or install via ComfyUI Manager by searching "ComfyUI-FluxRegionAttention". No models to download, nothing heavy; it's a small code-only pack built around Flux.1.

Troubleshooting is mostly about the mask being wrong in a way you can't see. If a region silently does nothing, the usual culprits are: the mask came through all-black (nothing above 0.5, so the pack treats it as an empty region and skips it), or the mask and the image are at different aspect ratios and the stretch pushed your painted area off the meaningful part. Save a preview of the mask before it hits the node - it's the fastest way to confirm what the pack is actually receiving. And keep the pack's own disclaimer in mind: results aren't always stable, and when a region misbehaves, changing the seed is often the actual fix, not editing your mask.

Categorysd

Inputs (2)

NameTypeDefaultDescription
maskMASK
conditionCONDITIONING

Outputs (1)

NameTypeDescription
REGIONREGION