import matplotlib.pyplot as plt import numpy as np from scipy import misc h = misc.imread("a.jpg") print(h.shape) f = misc.face(gray=True) print(f.shape) print(f.min(), f.max()) g = f mask = g > 150 g[mask] = 255 print(g.min(), g.max()) plt.imshow(g, cmap=plt.cm.gray) h = misc.imrotate(h, 75) h = misc.imresize(h, (90, 90)) plt.contour(h, 4) plt.figure() plt.imshow(g[80:90, 80:90], interpolation="nearest") plt.show() for i in range(10): plt.figure() x = np.arange(100) y = np.random.rand(100) plt.plot(x, y) plt.savefig(str(i) + ".pdf") plt.imsave("a.png", g, cmap=plt.cm.gray) misc.imsave("a.jpg", g)