Nodes/Masquerade Nodes/Convert Color Space
ComfyUI Node Runs on cloud

Convert Color Space

RGB, HSV, HSL, and why you'd switch

By BadCafeCode·Created 3 years ago·Updated 2 years ago· 479
Convert Color Space
  • image
  • IMAGE
in_space
out_space

RGB packs color and brightness together into three channels that all move at once - brighten a red object and its red, green, and blue channels all shift. HSV and HSL split that apart into hue (what color), saturation (how vivid), and value/lightness (how bright) as separate, independent channels. Convert Color Space switches an image between these representations, and the reason you'd want to is almost always so you can then operate on just one of those channels in isolation, rather than fighting RGB's coupling.

The pack's own docs point at exactly this pattern: after converting to HSV, you can run per-channel operations (invert, average, clamp, round - the kind of thing a Unary Image Op does) on a single channel without disturbing the others. Isolate the value/lightness channel and you've effectively got a grayscale operation that leaves hue and saturation untouched; isolate hue and you can build a rough color-based mask - anything within a hue range becomes a crude but fast way to select "the red things" or "the sky" without a model in the loop at all. It's the classic-computer-vision way to do what ClipSeg does with a neural net, cheaper and less flexible but instant and deterministic.

The inputs that matter

  • image - the image to convert.
  • in_space - the color space the input is currently in: RGB, HSV, or HSL.
  • out_space - the color space to convert to: RGB, HSV, or HSL.

Output is the converted image. Note this node doesn't auto-detect what space your image is in - you tell it via in_space, and it's on you to keep track of what representation an image is actually carrying as it moves through your graph, since a tensor holding HSV values will preview and behave strangely if something downstream assumes it's RGB.

Installing it

Convert Color Space is part of Masquerade Nodes. Install via ComfyUI Manager (search "Masquerade Nodes") or manually: cd ComfyUI/custom_nodes && git clone https://github.com/BadCafeCode/masquerade-nodes-comfyui, then restart ComfyUI. No models, no extra dependencies - it's a standard, well-understood color math conversion.

Common issues

The thing that trips people up almost every time is forgetting to convert back to RGB before saving, previewing, or feeding the image into anything that expects normal color data - an image left in HSV or HSL space will look completely wrong (garish, inverted, nonsensical colors) in a Preview Image node or a save, because those consumers assume RGB and don't know the values mean something else. Always pair a conversion out of RGB with a conversion back into RGB once you're done operating on the isolated channel; treat the non-RGB state as a temporary working format, not something to leave an image in.

CategoryMasquerade Nodes

Inputs (3)

NameTypeDefaultDescription
in_spaceCOMBO3 options: RGB, HSV, HSL
out_spaceCOMBO3 options: RGB, HSV, HSL
imageIMAGE

Outputs (1)

NameTypeDescription
IMAGEIMAGE