Advertisement
lamiastella

convert .npy to png

Jun 12th, 2017
331
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.34 KB | None | 0 0
  1. import numpy as np
  2. from matplotlib import pyplot as plt
  3. import matplotlib
  4. import glob
  5.  
  6.  
  7. for filename in glob.glob("*.*"):
  8.     if '.npy' in filename:
  9.         img_array = np.load(filename)
  10.         plt.imshow(img_array, cmap="gray")
  11.         img_name = filename+".png"
  12.         matplotlib.image.imsave(img_name, img_array)
  13.         print(filename)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement