I am loading image with the following code
image = PIL.Image.open(file_path)
image = np.array(image)
It works, but the size of array appears to be (X, X, 4)
, i.e. it has 4 layers. I would like normal RGB layers. Is it possible?
UPDATE
I found that just removing 4th channel is unsufficcient. The following code was required:
image = PIL.Image.open(file_path)
image.thumbnail(resample_size)
image = image.convert("RGB")
image = np.asarray(image, dtype=np.float32) / 255
image = image[:, :, :3]
Why?