Description
System:
Ubuntu 16.04.3 LTS
Python:
Python 3.5.2
zbarlight==1.2
Pillow==4.2.1
lib:
libzbar-dev/xenial,now 0.10+doc-10ubuntu1 amd64 [installed]
libzbar0/xenial,now 0.10+doc-10ubuntu1 amd64 [installed]
First:
I meet a strange image coule not be decoded.
But i use telegram to send this image ,and use my bot to get it .It convert to jpeg by the telegram client and it could be decode success.
So I try to convert the raw png to jpeg by image.convert('RGB'), but this jpeg image fail decode .
The raw png image file: (failed decode)
Convert by telegram Android client jpg file:(success decode)
Second:
I also found a image decode failed without any process, but after i use image.thumbnail() it could be decode success.
Part of my code:
remote_image = requests.get(url)
image_file = io.BytesIO(remote_image.content)
image = Image.open(image_file)
image.load()
zbarlight.scan_codes('qrcode', image)
image.thumbnail((int(image.size[0]/8), int(image.size[1]/8)))
zbarlight.scan_codes('qrcode', image)