RGB to HSV
Get a color into the scale OpenCV's masking actually wants
- rgb_color
- HSV_COLOR
If you've ever tried to do color-based masking in ComfyUI and gotten a black screen for your trouble, the culprit is usually a scale mismatch: RGB hue is 0–360 degrees, but OpenCV's HSV pipeline works with hue on a 0–179 scale and saturation/value on 0–255. RGB to HSV is the tiny node that converts a single COLOR into that exact OpenCV-friendly HSV form. It's not glamorous, but it's the difference between a mask that works and an afternoon of head-scratching.
The input is one rgb_color (the pack's COLOR type - produce one from the Color (RGB) node with r/g/b sliders, or Color (RGB from Hex) if you have a hex code). The output is HSV_COLOR, a tuple scaled the OpenCV way: (h, s, v) where h is 0–179 and s/v are 0–255. Internally it's colorsys.rgb_to_hsv followed by the rescale - nothing exotic.
What you actually do with it
The output feeds the pack's HSV color-analysis family. The most common destination is InRangeHSV, which builds a mask from two HSV colors (color_a/color_b) with hue modes like SINGLE, SPLIT (for reds that straddle the 0/179 wrap), and LARGEST/SMALLEST interval selection. Convert the color you care about, build a range around it, and you've got a targeted color mask. The output also flows into BuildColorRangeHSV when you want to derive bounds statistically instead of by hand.
So the pipeline looks like:
Color (RGB) → RGB to HSV → HSV_COLOR
↓
InRangeHSV (color_a / color_b) → MASK
The one trap
Remember the scale. If you're porting an HSV value from a tool that shows hue as 0–360, you'll need to halve it to get 0–179, and this node does that for you. Trust its output over the numbers in your head. The complementary-color and HSV-range nodes in the same pack all assume this 0–179 / 0–255 convention, so keeping everything in this node's output scale is the way to stay consistent across a workflow.
Installing
Ships in comfyui_bmad_nodes, bmad4ever's grab-bag of API, CV, and utility nodes. ComfyUI Manager - search "comfyui_bmad_nodes" (or "Bmad Nodes") - install, restart. Manual:
cd ComfyUI/custom_nodes
git clone https://github.com/bmad4ever/comfyui_bmad_nodes
cd comfyui_bmad_nodes
pip install -r requirements.txt
Restart after. No model downloads. This node sits in the CV half of the pack, so it needs opencv-python (pinned to ~4.8 in requirements) - if startup logs say "Not loaded: CV nodes," that's the missing dependency. And keep ComfyUI itself current; the pack complains if it's too old.
Verdict: it's a two-line converter, but it's the correct two lines. If you're doing any HSV masking with this pack, this node is the glue that makes your color values land where OpenCV expects them.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| rgb_color | COLOR | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| HSV_COLOR | HSV_COLOR | — |