from PIL import Image
import numpy as np
target_file = r'D:rgb_testCtest.tga'
img = Image.open(target_file)
basePixel = np.array(img)
old_rgb_value = (255, 0, 0)
new_rgb_value = (57, 57, 57)
I opened an image using PIL. And then changed it into numpy array. I want to find index which matches old_rgb_value.(255, 0, 0) So I got the result as below.(array[0], array[0])
I know I can change one value using where function.
But how can I change three values all together?
[255, 0, 0] -> [57, 57, 57]
1