Mix Color By Mask
Tint or recolor just the masked area
- image
- mask
- IMAGE
Mix Color By Mask is the simplest kind of masked edit there is: pick a flat RGB color, pick a mask, and blend the color into the image wherever the mask says to. No sampling, no model, no denoising - it's interpolation, not generation. Where the mask is fully white you get pure color; where it's black you get the original image untouched; anywhere in between (a feathered edge, a soft mask from ClipSeg) you get a proportional blend.
That makes it a fast, cheap tool for a specific job: recoloring a masked object without regenerating it. Tint a shirt, change a wall color, push a background toward a flat color for a green-screen-style composite, or build a quick debug overlay to see what a mask is actually covering (crank the color to something obviously artificial like pure red and you'll spot mask errors instantly, faster than staring at a black-and-white mask preview). It's also the node the pack's own README points to as a lightweight escape hatch when Paste By Mask's resize logic gives you trouble - mixing in a solid color is a lot more forgiving than pasting a whole second image.
The inputs that matter
- image - the image to modify.
- r, g, b (INT, 0–255 each) - the color you're mixing in. Set all three to build whatever color you need; there's no color picker widget here, just three number fields, so ordinary web-safe RGB values (255, 0, 0 for red, 0, 0, 0 for black) work as expected.
- mask - the mask controlling how much of that color shows through at each pixel.
The single output is the resulting image, ready to save, preview, or feed further down the graph.
Because this operates per-pixel on a continuous mask value, it's worth remembering the mask doesn't have to be binary. A soft, blurred mask gives you a soft, blurred color transition - useful when you want a color shift that fades naturally rather than stopping at a hard edge. If you want a hard edge instead, round the mask first (Combine Masks with round_result on, or Mask Morphology's close/open, will get you there).
Installing it
Mix Color By Mask is one of the nodes in Masquerade Nodes, BadCafeCode's small mask-utility pack. Get it through ComfyUI Manager - search "Masquerade Nodes" - or manually: cd ComfyUI/custom_nodes && git clone https://github.com/BadCafeCode/masquerade-nodes-comfyui, then restart ComfyUI. Like most of the pack, this node needs nothing beyond what ComfyUI already ships with - no model weights, no extra pip installs. The pack predates ComfyUI Manager and was deliberately built dependency-free; its own README suggests Impact Pack as the more actively developed alternative if you're choosing a mask/segmentation pack from scratch and don't specifically need that property, but for a simple utility like this one the choice barely matters.
Common issues
There isn't much to go wrong here mechanically - it's addition and multiplication, not a model doing something unpredictable. The usual gotcha is a size mismatch between image and mask; if your mask came from a different resolution image than the one you're tinting (a common trap when a mask was generated earlier in the graph at a smaller working resolution), resize the mask to match before wiring it in, since this node does per-pixel math and won't resample for you. If the color you expected doesn't show up at all, double-check the mask isn't inverted - a mask that's black where you meant white will apply your color everywhere except the region you wanted.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| r | INT | 00–255 | — |
| g | INT | 00–255 | — |
| b | INT | 00–255 | — |
| mask | IMAGE | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |