Change color range in python

Heya, im useing python, and i wonder how to load an image
and turn ever color in a spesific range (40,40,255) into 0,0,255

Read tutorial Thresholding Operations using inRange

that code is for a video, i cant get it to work with a simple image, also i have seen ppl doing it other places with far less code, it dident work for me but it worked for them

and also this one

the basic operation is cv::inRange. you can use pure numpy too. either produces a “mask”. you use the mask and the original image to assign new color to only the masked pixels.

“didn’t work” is a poor problem description. please be more detailed if you want help.

what does it mean ‘it didn’t work’? can you post source code and error message?