Nodes/RGBYP Mask Editor (RGB + YP)/RGBYP Mask Composite (With Strength)
ComfyUI Node

RGBYP Mask Composite (With Strength)

RGBYP Mask Composite (With Strength)

By akawana·Created 9 months ago·Updated 8 days ago· 5
RGBYP Mask Composite (With Strength)
  • red_mask
  • green_mask
  • blue_mask
  • yellow_mask
  • pink_mask
  • mask
red_strength0.50
green_strength0.50
blue_strength0.50
yellow_strength0.50
pink_strength0.50
invertfalse

Most mask consumers want a simple black-and-white mask: in or out. But some of the most interesting things in ComfyUI want a mask where the gray value itself means something - most famously Differential Diffusion, where each gray level maps to a different denoise strength, so the same generation pass can fully redraw one region while barely touching another. RGBYP Mask Composite (With Strength) exists to build exactly that: one single grayscale MASK where each of your five painted regions becomes a specific gray shade, chosen by you.

What goes in

Five masks - red_mask, green_mask, blue_mask, yellow_mask, pink_mask (the outputs of RGBYP Mask To Regular Masks, or items from RGBYP Mask To List) - plus a strength slider for each (red_strength through pink_strength, 0–1, default 0.5), and an invert toggle.

The mechanism, in plain terms

For each color, the node multiplies that mask by its strength: paint it red and set red_strength to 0.8, and wherever red was painted you get 0.8 gray. Empty masks are skipped, mismatched resolutions get resized to the first mask's shape, and everything gets clamped to 0–1 so the sums can't overflow into white noise. The five weighted masks are then added together into one output mask.

The invert flag flips the math: instead of mask × strength summed together, it's (1 − mask) + strength, and the results are multiplied. The net effect is a keep-out mask - the painted regions get cut down to a chosen strength while everything around them stays strong. Same inputs, opposite intent. If your first result is backwards, invert is the first thing to try.

Where the strengths come from

The sliders are right on the node, which is fine for a one-off. But if you're already running the RGBYP strength pair elsewhere, you can drive these widgets from RGBYP Mask Strength Out - feed its five float outputs into the matching strength inputs and your composite stays in sync with the rest of the graph.

What to do with the output

The single mask output wires straight into Differential Diffusion nodes and any other "gray means something" consumer. It's also handy when you want one mask to feed a node that only accepts a single MASK - say, an inpaint or ControlNet input - but you need different weights per region. This is the node that turns five painted colors into one nuanced mask, and there isn't really a stock ComfyUI node that does the same in one step.

Installing it

It's part of the RGBYP pack:

cd ComfyUI/custom_nodes
git clone https://github.com/akawana/ComfyUI-RGBYP-Mask-Editor.git

then restart ComfyUI - or use ComfyUI Manager and search RGBYP. No models, no extra dependencies.

One word of warning

Because the regions get summed, overlapping painted areas will stack their strengths (two regions at 0.6 each = 1.2, clamped back to 1.0). The editor lets you paint the same pixel in multiple colors; avoid it if you want clean per-region weights, or deliberately use it as a feature.

CategoryAK/RGBYP

Inputs (11)

NameTypeDefaultDescription
red_maskMASK
green_maskMASK
blue_maskMASK
yellow_maskMASK
pink_maskMASK
red_strengthFLOAT0.500–1
green_strengthFLOAT0.500–1
blue_strengthFLOAT0.500–1
yellow_strengthFLOAT0.500–1
pink_strengthFLOAT0.500–1
invertBOOLEANfalse

Outputs (1)

NameTypeDescription
maskMASK