Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to take bytes as input instead of image path? #23

Open
CRonaldo1997 opened this issue Sep 5, 2018 · 2 comments
Open

how to take bytes as input instead of image path? #23

CRonaldo1997 opened this issue Sep 5, 2018 · 2 comments

Comments

@CRonaldo1997
Copy link

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!

@jgtjerry
Copy link

jgtjerry commented Jul 4, 2019

Were you able to solve this?

@whc2001
Copy link

whc2001 commented Feb 3, 2020

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants