show grayscale image python code example
Example 1: plt.imshow grayscale
plt.imshow(arr, cmap='gray', vmin=0, vmax=255)
Example 2: python image to grayscale
from PIL import Image
img = Image.open("image.jpg")
img.convert("L").save("result.jpg")
plt.imshow(arr, cmap='gray', vmin=0, vmax=255)
from PIL import Image
img = Image.open("image.jpg")
img.convert("L").save("result.jpg")