g0dkar / qrcode-kotlin

QRCode Generator implemented in pure Kotlin
https://qrcodekotlin.com/
MIT License
190 stars 20 forks source link

QR Code images are large, unnecessarily complex, and not well detected #141

Open dgmltn opened 1 month ago

dgmltn commented 1 month ago

I'm not sure this is a bug, but I've noticed that the QR codes generated by this library are more complex than the ones generated by zxing. They're also not easily detected. As an example, the top image here is generated by the qrcode-kotlin, and the bottom generated by zxing.

  1. What's the reason for all the extra bits?
  2. The qrcode-kotlin image is not as easily detected. My phone's camera app doesn't seem to ever detect the qr code. The qr code scanner app will detect, but only if I carefully move around a bit. The zxing qr code, on the other hand, is always detected instantly, and also detected quickly by the camera app.

image

slaha commented 1 month ago

I don't know if this is related to the issue but this look suspiciously to me:

    val qrCodeProcessor: QRCodeProcessor =
        QRCodeProcessor(data, ErrorCorrectionLevel.VERY_HIGH, graphicsFactory = graphicsFactory)

    /** Computed type number for the given [data] parameter */
    val typeNum = QRCodeProcessor.typeForDataAndECL(data, errorCorrectionLevel).coerceAtLeast(minTypeNum)

Why the qrCodeProcessor does not use errorCorrectionLevel and forces ErrorCorrectionLevel.VERY_HIGH?