Nodes/KayTool/𝙆 Image Mask Composer
ComfyUI Node

𝙆 Image Mask Composer

Drop a masked cutout onto a flat color background

By kk8bit·Created 2 years ago·Updated about a year ago· 364
𝙆 Image Mask Composer
  • image
  • mask
  • IMAGE
background_colorblack

Despite the similar name, this isn't part of the Image Composer / Image Cropper pair - it's a simpler, standalone node that does one specific job well: take an image and a mask, and composite the masked region onto a solid color background. Feed it a cutout and its mask (from Remove BG, from a BiRefNet Loader pass, from anything that produces a mask really - it doesn't care where the mask came from), pick a background color, and get back a flat, clean image with the subject sitting on that fill.

This overlaps in spirit with the Preview dropdown on Remove BG - both let you check a cutout against black, white, or a color plate - but the difference matters: Remove BG's preview is just for eyeballing, it doesn't change what comes out of that node's IMAGE output. Image Mask Composer actually produces the composited result as its output, so you can wire the flat-background version onward into the rest of your pipeline instead of just using it as a visual check.

How it works

It's a straightforward alpha-style composite: wherever the mask says "subject," the original image shows through; wherever it doesn't, the chosen background_color fills in. It works with any mask you hand it, so it's not tied to a specific background-removal method - useful as a general "flatten this onto a solid backdrop" utility even outside a background-removal workflow, for anything where you've got an image and a mask and want a clean, uniform result.

The inputs and output that matter

  • image (IMAGE) - required.
  • mask (MASK) - required; defines what counts as "subject" versus "background."
  • background_color (choice of black / white / gray / red / green / blue, default black).
  • IMAGE (output) - the composited result, subject on a flat fill.

Installing it

Comes with the full KayTool pack: ComfyUI Manager → search KayTool → install → restart, or cd ComfyUI/custom_nodes && git clone https://github.com/kk8bit/KayTool and restart.

Common issues

Results here are only as good as the mask you feed in - this node doesn't do any segmentation itself, so a rough or poorly-edged mask (soft hair, semi-transparent fabric) will show exactly those imperfections against the flat background, often more visibly than it would against a busy real background. If edges look rough, that's a mask-quality problem to fix upstream (KayTool's own Mask Blur + can help soften a too-hard edge before it reaches this node), not something this node can compensate for. And since the background choice is limited to six fixed colors rather than a custom color picker, if you need an exact brand color or something outside that list, you'll need a different compositing node - this one is built for quick, standard preview/comparison backdrops, not precise color matching.

CategoryKayTool/Image

Inputs (3)

NameTypeDefaultDescription
imageIMAGE
maskMASK
background_colorCOMBOblack6 options: black, white, gray, red, green, blue

Outputs (1)

NameTypeDescription
IMAGEIMAGE