OpenCV inRange_1
The identical twin of the color-mask node
- src
- lowerb
- upperb
- dst
- nparray
First, the honest answer to the question you're actually here for: OpenCV inRange_1 and OpenCV inRange_0 are the same node. Same inputs, same behavior, same cv2.inRange call under the hood. If you've already read the inRange_0 article, you know everything this one knows. So why do two of them exist? Because this whole pack is auto-generated from OpenCV's type-stub files, and OpenCV lists inRange twice - once typed with MatLike images and once with UMat images. The generator dutifully emitted one node per overload and numbered them. At runtime, with real nparrays, there is no functional difference.
What it does
Color-range thresholding. Feed it an image, a lower bound, and an upper bound; it returns a single-channel mask that's 255 where the pixel's color fell inside [lowerb, upperb] (inclusive, compared per channel) and 0 everywhere else. That mask is exactly what you hand to a compositing or inpainting branch when you want the pipeline to only touch one color region - a red car, a skin-tone band, a sky.
Inputs and outputs
From the info schema, identical to inRange_0:
src- your image as an NPARRAY (run it throughImage2Nparrayfirst: it converts Comfy's RGB tensor to OpenCV's BGRuint8).lowerb,upperb- NPARRAYs holding the per-channel range.dst- optional out-parameter; ignore it, the node returns the mask anyway.- Output
nparray- the0/255mask.
The one real friction is that the bounds are NPARRAYs, not typed-in numbers, so you need an array-producing node to build them. If that sounds like more plumbing than the job deserves, threshold_0 in the same pack takes a plain FLOAT and is the friendlier single-cutoff tool. inRange is for when you want a genuine multi-channel color band.
Installing
Same pack as every node here - opencv-comfyui. One install covers all 600+ of them:
cd ComfyUI/custom_nodes
git clone https://github.com/geroldmeisinger/opencv-comfyui
cd opencv-comfyui
pip install -r requirements.txt
ComfyUI Manager also finds it by searching "opencv-comfyui". No model downloads - the dependencies are opencv-contrib-python, numpy, and torch (which ComfyUI already has). Restart and you're set.
Gotchas
Same family as the rest of the pack: keep batch_size == 1 (use ImageFromBatch with length=1 if needed), remember the pack is BGR so convert grayscale-requiring images with cvtColor code 6, and expect the occasional invalid syntax (<unknown>, line 0) when a string input isn't valid Python literal syntax. And since this node is a pure overload duplicate, you gain nothing by switching to it from inRange_0 - use whichever your workflow already has, and spend the extra mental budget on whether a simple threshold_0 would do the job with far less array plumbing.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| src | NPARRAY | — | |
| lowerb | NPARRAY | — | |
| upperb | NPARRAY | — | |
| dstopt | NPARRAY | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| nparray | NPARRAY | — |