OpenCV cvtColor_1
The Twin That's Identical to cvtColor_0 (Just Pick One)
- src
- dst
- nparray
OpenCV cvtColor_1 is cvtColor_0's identical twin, and the whole useful story about it is: don't spend time choosing between them. Both call the same cv2.cvtColor, both take the same inputs, both return a converted nparray. The _1 suffix is a side effect of how this pack is generated, not a different algorithm.
Here's why the numbering exists. geroldmeisinger/opencv-comfyui auto-generates one ComfyUI node per overload it finds in cv2's Python type stubs. OpenCV declares most functions twice - once for MatLike (the normal numpy-backed image) and once for UMat (OpenCV's unified memory wrapper). The generator dutifully emits both as separate nodes, and since ComfyUI can't distinguish the input types, you get two functionally identical wrappers. cvtColor_0 and cvtColor_1 are that pair. The same pattern repeats all over this pack: dct_0/dct_1, decolor_0/decolor_1, and so on.
What it does
Converts an image between color spaces using an integer enum code:
6=BGR2GRAY8=GRAY2BGR4=BGR2RGB
This matters in this pack specifically because ComfyUI images are RGB float32 tensors in 0–1, while OpenCV works on BGR uint8 nparrays in 0–255. The conversion nodes Image2Nparray/Nparrays2Image handle the RGB/BGR flip at the boundaries, but anything needing grayscale or a different channel order passes through here first. See the cvtColor_0 article for the full walkthrough - it's the same node.
Inputs and outputs
Same as the twin:
src(NPARRAY) - input image fromImage2Nparray.code(INT) - conversion enum (6for grayscale, etc.).dstCn(INT) - output channels;0lets OpenCV infer it.hint(INT) - conversion hint, default0.dst(NPARRAY, optional) - the out-parameter; leave it unconnected, the README says so.nparray(NPARRAY, output) - the converted result.
Install
ComfyUI Manager (search opencv-comfyui) or:
cd ComfyUI/custom_nodes
git clone https://github.com/geroldmeisinger/opencv-comfyui
pip install opencv-contrib-python
Restart ComfyUI. No model downloads. Mind the package name - opencv-contrib-python, not the README's opencv-python-contrib.
If you hit img.type() == CV_8UC1 assertion errors, the function wants grayscale and you're feeding it color - run cvtColor with code 6 first. If you get 'NoneType' object has no attribute 'shape' from Nparrays2Image, you fed it something that isn't an image. And batch-size-one only, as with the whole pack. Everything else, you can find in the cvtColor_0 article.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| src | NPARRAY | — | |
| code | INT | — | |
| dstCn | INT | — | |
| hint | INT | — | |
| dstopt | NPARRAY | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| nparray | NPARRAY | — |