I am opening an image using PIL but its shape is being read as (400, 256, 4) whereas it should be (400, 256, 1). Here is my code:
from PIL import Image
img = Image.open(file_name)
img = np.array(img)
print(img.shape) # (400, 256, 4)
Does it have to do with how I encoded the image when I made it, or is there a way to read it in as 1 band?
For reference on the image, I encoded it using matplotlib's https://matplotlib.org/devdocs/api/_as_gen/matplotlib.pyplot.savefig.html