I have a grayscale image:
But plt.inshow
displays a wrong image (clearly, it differs from the origin one):
from PIL import Image
import matplotlib.pyplot as plt
import matplotlib.cm as cm
img = Image.open('...')
plt.imshow(image, cmap=cm.gray)
the output is
I tried the img.show()
method, and it can display the same image as the origin one.
My question is: how to display grayscale image correctly using pyplot
?
I have tried Display image as grayscale using matplotlib, but it dose not work still.