python-zxing icon indicating copy to clipboard operation
python-zxing copied to clipboard

how to take bytes as input instead of image path?

Open CRonaldo1997 opened this issue 7 years ago • 2 comments

As described in the README, reader.decode() takes image path as parameter: reader = zxing.BarCodeReader("/var/opt/zxing") barcode = reader.decode("/tmp/image.jpg")

How to take bytes instead of image path? For example: with open('/tmp/image.jpg','rb') as img_file: img_bytes = img_file.read() barcode = reader.decode(img_bytes)

Thanks!

CRonaldo1997 avatar Sep 05 '18 06:09 CRonaldo1997

Were you able to solve this?

jgtjerry avatar Jul 04 '19 20:07 jgtjerry

I don't think it's possible. Take a look at the code and you'll find it just calls zxing package from the command line. You will have to write the stream into a temporary file first.

whc2001 avatar Feb 03 '20 19:02 whc2001