Nodes/ComfyUI-Muye-nodes/遮罩区域上色
ComfyUI Node

遮罩区域上色

Paint your mask regions a solid color, for visibility or for compositing

By muyexiuluo·Created about a year ago·Updated 23 days ago· 89
遮罩区域上色
  • 图像
  • 遮罩
  • 颜色输入
  • 上色图像
颜色选择

MaskColorize takes an image and a mask, and fills everywhere the mask is white with a flat solid color. That's the whole job, and it sounds trivial - but it's two genuinely different tools in one tiny node.

First, it's a visibility tool. Masks are the invisible backbone of half of ComfyUI - inpainting, detailing, background removal all run on them - and the failure mode of mask work is that you can't see what you're working with. Overlay your mask as a colored region on the actual image and suddenly you can tell at a glance whether the detector grabbed the whole face or just half of it, whether the mask bleeds onto the background. The KB's detection-and-masking material is blunt about this: the mask is where detailer pipelines go wrong, and being able to eyeball it is half the debugging. Wire the output to a preview node and you've got a debug view that beats squinting at a white blob.

Second, it's a compositing prep step. Colorize a region red, then use that as a tinted overlay - or feed the result into a compositor so a colored region gets pasted onto another image. When you need a marker, a highlight, or a region you can visually track through a pipeline, this is the fastest way to make it.

Mechanically it's dead simple: where the mask exceeds 0.5 it replaces the pixel with the chosen color, everywhere else it leaves the original. The 颜色选择 dropdown has six built-ins - 黑, 白, 灰, 红, 绿, 蓝 - and if that's not enough there's an optional 颜色输入 socket that takes an arbitrary COLOR value (R, G, B). The single output, 上色图像, is a full IMAGE. It normalizes the mask's dimensions, so it's tolerant of the slightly different mask shapes nodes emit.

Install

Standard for this pack: ComfyUI Manager → search "muye" → install "ComfyUI-Muye-nodes", restart. Manually:

cd ComfyUI/custom_nodes
git clone https://github.com/muyexiuluo/ComfyUI-Muye-nodes
cd ComfyUI-Muye-nodes
pip install -r requirements.txt

then restart. This node is torch-only - no extra deps beyond what ComfyUI ships - so it works even if the pack's heavy requirements fail. The README's manual block still references an older ComfyUI_Muye.git URL; use the -nodes one above.

Common issues

The 颜色输入 socket overrides the dropdown when it's connected - if you're connected to it and the color looks wrong, that's why. And the mask semantics follow ComfyUI's convention: white (high values) is the selected region, black is untouched. If your colored area comes out as everything except what you expected, your mask is inverted - flip it upstream. Labels are Chinese by design (display name 遮罩区域上色); if the node is missing, check the console for a [Muye] Failed to load module line, which means the pack skipped the module on import.

CategoryMuye/Mask

Inputs (4)

NameTypeDefaultDescription
图像IMAGE
遮罩MASK
颜色选择COMBO6 options: 黑, 白, 灰, 红, 绿, 蓝
颜色输入optCOLOR

Outputs (1)

NameTypeDescription
上色图像IMAGE