# importing libraries from PIL import Image # Python Imaging Library import numpy as np # Numerical Python import matplotlib.pyplot as plt # Python plotting %matplotlib inline # use in a notebook format I = Image.open('lena_gray_512.tif') type(I) a = np.asarray(I,dtype=np.float32) plt.imshow(a,cmap='gray',interpolation='none') plt.title('Lena'),plt.axis('off') plt.show()
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter