import numpy as np
import matplotlib.pyplot as plt
from PIL import Image
fname = 'image.png'
image = Image.open(fname).convert('L')
arr = np.asarray(image)
plt.imshow(arr, cmap='gray')
plt.show()
Display image as grayscale using matplotlib