Skip to content
Advertisement

Scaning QRcode from image (not from camera) using ZXing

I am using the ZXing library for barcode scanning.

I want to scan a barcode using this library from an image (e.g., on the SD card) rather than from the camera.

How can I do this using the ZXing library?

Advertisement

Answer

I wanted to test it out before posting it so it took me a while, I’m also using ZXing right now so this comes handy for me as well:

First of course, read the image from the gallery (this can be in your activity):

JavaScript

After that, just get the image uri on the activity result and then ZXing will do the magic:

JavaScript

I tested this and it works, cheers.

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement