- Reading an image in PIL gives a native PIL object.The size of the image is represented as width,height(PIL does not return channels)(400,300).This PIL object can be converted into numpy array by passing the PIL object to numpy.array().The returned object is a numpy array of shape attribute rows,columns,channels(300,400).Plotting both images in matplotlib gives rightly plotted image.
import matplotlib.pyplot as plt
from PIL import Image
import numpy as np
img = Image.open('data/image.jpg').convert('L')
print(img.size)#(400,300)
np_img = np.array(img)