im = Image.open('test.png')
im = im.convert('RGBA')
data = np.array(im)
red, green, blue, alpha = data.T
white_areas = (red == 255) & (blue == 255) & (green == 255)
data[..., :-1][white_areas.T] = 255, 0, 0
im2 = Image.fromarray(data)
im2.show()
Python: PIL replace a single RGBA color