Skip to content

Instantly share code, notes, and snippets.

@eliasnogueira
Last active February 11, 2021 20:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eliasnogueira/d59035a796f9c78669d39a9868af3bcd to your computer and use it in GitHub Desktop.
Save eliasnogueira/d59035a796f9c78669d39a9868af3bcd to your computer and use it in GitHub Desktop.
Code from appium-read-qrcode
private static String decodeQRCode(BufferedImage qrCodeImage) {
Result result = null;
try {
LuminanceSource source = new BufferedImageLuminanceSource(qrCodeImage);
BinaryBitmap bitmap = new BinaryBitmap(new HybridBinarizer(source));
result = new MultiFormatReader().decode(bitmap);
} catch (NotFoundException e) {
log.error("QRCode not found", e);
}
return result.getText();
}
@eliasnogueira
Copy link
Author

The complete code can be found at https://github.com/eliasnogueira/appium-read-qrcode

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment