daily pastebin goal
17%
SHARE
TWEET

Untitled

a guest Jan 12th, 2018 51 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. from PIL import Image
  2.  
  3. im = Image.open('bulk.png', 'r')
  4. pix_val = list(im.getdata())  #read pixel values
  5.  
  6. pix_val_flat = [x for sets in pix_val for x in sets]  #flatten the list
  7. pix_val_flat = list(filter((0).__ne__, pix_val_flat)) #filter 0
  8. text = ''.join(chr(i) for i in pix_val_flat)   #covert to ASCII
  9. print(text)
RAW Paste Data
Top