Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from PIL import Image
- barcode = Image.open(r"C:\Users\James\Pictures\barcode.png")
- outStrBin = ""
- width, height = barcode.size
- for x in range(0,width):
- pixel = barcode.getpixel((x,2))
- if pixel[0]==255: #white
- outStrBin+="1"
- else: #black
- outStrBin+="0"
- print(outStrBin)
- barcode.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement