I simply want to darken an image that I've loaded using scikit-image in python.
If I do this:
test_image = io.imread("TestProvs2.bmp")
test_image = test_image * 0.5
show_map(test_image)
The array of RGB values does indeed get scaled down, so that each RGB value is 127.5.
Yet the resulting image has maximum values (left = original, right = new):

When you read an image, the data type of your image is
uint8. When you multiply it by0.5, Python casts it tofloat64but an image must beuint8, so it gives this errorWhat you have to do is to cast it to
uint8manually.Don't forget to import
numpyGenerally, it's better to use OpenCV for image processing.