, matplotlib.pyplot. Matplotlib .bmp , , CMAP . . , cmap="gray".
from PIL import Image
img= Image.open(r'./test/test2.bmp')
plt.imshow(img,cmap='gray',vmin=0,vmax=255)
, vmin vmax, , , python .
PIL:
img=matplotlib.image.imread(r'/Users/giacomo/Downloads/test2.bmp')
plt.imshow(img,cmap='gray',vmin=0,vmax=255)
PIL .png .
PIL.Image, :
from PIL import Image
img= Image.open( r'./test/test2.bmp')
img.show()
, I-Python Notebook,
- 'P' ( : , ImagePalette, ). .convert, matplotlib plt.imshow:
convertedimg=img.convert('P')
plt.imshow(convertedimg)
