Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from PIL import Image
- im = Image.open('bulk.png', 'r')
- pix_val = list(im.getdata()) #read pixel values
- pix_val_flat = [x for sets in pix_val for x in sets] #flatten the list
- pix_val_flat = list(filter((0).__ne__, pix_val_flat)) #filter 0
- text = ''.join(chr(i) for i in pix_val_flat) #covert to ASCII
- print(text)
Add Comment
Please, Sign In to add comment