Colored Image (mtb)
Generate a solid-color image (and composite over it) in ComfyUI
- color
- foreground_image
- foreground_mask
- IMAGE
Colored Image (mtb) makes a plain, solid-color image at whatever size you ask for. Sounds almost too simple to need a node, but a flat color fill is one of those primitives you end up wanting constantly - as a background, as a matte, as a base to composite onto, or as raw material for a mask.
The everyday uses: a solid backdrop to place a cut-out subject on, a color card for testing a workflow, a fill to letterbox or pad an image, or a base layer in a compositing chain. And it does a bit more than "just a rectangle of color" - it can take a foreground image and a mask and lay that foreground over the color, so in one node you get "subject on a solid background." That makes it a lightweight compositing node, not only a generator.
It's in the generate section of MTB Nodes (comfy_mtb) by melMass.
How it works
At its base it creates a tensor of the size you specify, filled with a single color. When you also give it a foreground image and a mask, it composites the foreground onto the color background using the mask to decide what shows through - white areas of the mask reveal the foreground, black areas keep the background color. There's an opacity control for how strongly the foreground sits on top, and an invert to flip the mask. No model, no generation in the diffusion sense - it's direct image construction.
The inputs and outputs that matter
color(COLOR) - the fill color, picked from a color widget.width/height(default 512×512) - the output dimensions. Set these to match whatever the color needs to line up with downstream.foreground_image(optional) - an image to composite over the color. Leave it empty for a plain solid fill.foreground_mask(optional) - the mask that decides which parts of the foreground show over the color background.invert(optional, default off) - flips the mask, swapping what's kept versus filled.mask_opacity(optional, default 1) - how opaque the composited foreground is over the color.
Output is a single IMAGE - either the solid color, or the foreground composited onto it.
How to install it
ComfyUI Manager: search MTB Nodes, install, restart. Manual:
cd ComfyUI/custom_nodes
git clone https://github.com/melMass/comfy_mtb
then restart. Pure Python - no models, nothing extra to fetch.
Common issues & troubleshooting
Size mismatch when compositing. If your foreground_image and mask aren't the same dimensions as the width/height you set, the composite won't line up cleanly. Match the color image's size to the foreground you're placing on it (or resize the foreground first).
The mask is backwards. If the foreground is hiding where you wanted it shown (or vice versa), the mask polarity is flipped - toggle invert, or invert the mask upstream. White = show foreground, black = show the color.
The foreground looks faint. That's mask_opacity below 1, or a soft/grey mask. Push opacity to 1 for a fully solid foreground, and check the mask isn't a low-contrast grey when you expected a hard cut.
Just want a plain color and got something odd. Leave foreground_image and foreground_mask unconnected - with no foreground, the node returns a clean solid fill of your chosen color at the given size.
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| color | COLOR | — | |
| width | INT | 51216–8160 | — |
| height | INT | 51216–8160 | — |
| foreground_imageopt | IMAGE | — | |
| foreground_maskopt | MASK | — | |
| invertopt | BOOLEAN | false | — |
| mask_opacityopt | FLOAT | 1.0 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |