Inconsistent QR Code decoding

Skip to first unread message


Aug 17, 2022, 4:39:37 AM8/17/22
to zxing

On my project we use ZXing for integration testing. About one in 5 tests fail due to ZXing running into a NotFoundException of ChecksumException. All QR codes are of the same format. I will add 3 of them into this message. One of them passes the scan, one causes a ChecksumException and another causes a NotFoundException.

We send these screenshots using the following code:

public String decodeQRCode(final BufferedImage bufferedImage) {
    final LuminanceSource source = new BufferedImageLuminanceSource(bufferedImage);
    final BinaryBitmap bitmap = new BinaryBitmap(new HybridBinarizer(source));
    try {
      final Map<DecodeHintType, Object> hints = Map.of(
          DecodeHintType.TRY_HARDER, true
      return new QRCodeMultiReader().decode(bitmap, hints).getText();
    } catch (final NotFoundException | FormatException | ChecksumException e) {
      throw new RuntimeException("QR code not found", e);


Reply all
Reply to author
0 new messages