Guest User

Untitled

a guest
May 27th, 2018
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. re_im.fromarray(tumps)
  2.  
  3. AttributeError: 'Image' object has no attribute 'fromarray'
  4.  
  5. from PIL import Image
  6. import numpy as np
  7. filename = 'any.png'
  8. import pickle
  9. im = Image.open(filename)
  10. data = np.asarray(im.getdata())
  11. f = open("test_file.dat","wb")
  12.  
  13. dumps = pickle.dump(data,f)
  14.  
  15. f = open("test_file.dat","rb")
  16. tumps = pickle.load(f)
  17. re_im = Image.new(im.mode, im.size)
  18. re_im.fromarray(tumps)
  19. re_im.show()
  20.  
  21.  
  22. python3.6.3
  23. PIL.PILLOW_VERSION
  24. Out[10]: '5.1.0'
Add Comment
Please, Sign In to add comment