ComfyUI Node Runs on cloud

Color Blend

Photoshop-style color matching for a pasted face

By ArtBot2023·Created 3 years ago·Updated 2 years ago· 102
Color Blend
  • blend_image
  • base_image
  • IMAGE
mode

The hardest part of a face swap isn't cutting or pasting - it's making the pasted face look like it was lit and colored by the same scene. A face generated on a white studio background plopped onto a warm, dim indoor photo screams "cutout" before anyone looks twice. Color Blend exists to fix exactly that: it transfers the color character of one image onto another, using the classic Photoshop blend modes.

It's the node that does what "match the skin tone and lighting" means in this pack. You feed it the blend image (the one whose color you want, e.g. the base photo's face region) and the base image (the one you want to recolor - the generated face), and it produces the base recolored with the blend's hue or saturation, depending on the mode you pick.

How it works

This is a faithful implementation of Photoshop's Hue / Saturation / Color / Luminosity blend modes, done in a custom HSY color space rather than the usual HSL. HSY (hue, saturation, luma) with the classic ITU luma weights (R=0.3, G=0.59, B=0.11) is what Photoshop uses for these modes, so the math is deliberately not the same as OpenCV's HLS. The node converts both images to HSY, mixes channels per the selected mode, and converts back:

  • Hue - take the blend's hue, keep the base's saturation and luminosity. Recolors everything toward the blend's dominant color.
  • Saturation - take the blend's saturation, keep the base's hue and luminosity. Changes intensity of color, not color itself.
  • Color - blend's hue and saturation, base's luminosity. This is the classic "colorize a grayscale image" mode.
  • Luminosity - blend's luminosity only. Transfers brightness/lighting without touching color.

For a face swap you'll almost always reach for Hue or Color: they push the generated face toward the base photo's skin tone while keeping the face's own shading. Luminosity is the odd one out - it maps the base photo's lighting onto the face, useful when the generated face has wrong overall brightness.

Wiring it

Both inputs take plain IMAGE tensors, and the output is an IMAGE:

  • blend_image - where the color comes from.
  • base_image - where the shape and (depending on mode) luminosity come from; the output is this image recolored.

Note both images must have matching dimensions - the blend is pixel-per-pixel, there's no resizing built in. In the shipped workflow the base image is upscaled to match before blending.

Installing the pack

Ships with Character Face Swap: ComfyUI Manager → search Character Face Swap → install → restart, or:

cd ComfyUI/custom_nodes/
git clone https://github.com/ArtBot2023/CharacterFaceSwap.git
cd CharacterFaceSwap
python install.py          # on the bundled Windows build: ../../../python_embeded/python install.py

Color Blend itself only needs numpy and OpenCV, both of which ComfyUI already has - no models, no extra downloads. Run install.py anyway so the pack's facexlib dependency is present for the other nodes.

Common problems

  • "size mismatch" / error comparing tensors: the two input images aren't the same dimensions. Scale them to match first (ImageScale, or an upscaler) - the node does no auto-resizing.
  • Output looks flat or grey-ish: that's usually picking Color or Luminosity when you meant Hue. Color also transfers saturation, which can drain a face's warmth; Hue is the gentler option.
  • No visible change at all: if both images are already color-matched (e.g. you swapped into a similar-lit photo), that's the expected result - the mode is doing its job.

It's a small node, but it's the difference between a face that looks composited and one that looks photographed.

CategoryCFaceSwap

Inputs (3)

NameTypeDefaultDescription
blend_imageIMAGE
base_imageIMAGE
modeCOMBO4 options: Hue, Saturation, Color, Luminosity

Outputs (1)

NameTypeDescription
IMAGEIMAGE