I'm writing an application that generate and read QR to pass data. The QR content is base64 encoded binary (I'll call it payload for this purpose)

The payload is quite long (answer should not try to reduce the length of the payload) and the content is proprietary. The length of the payload is variable (but should not exceed 1.5 times of the length of example provided in this question). The QR setting is set to LOW error correction (I'm using Endroid\QrCode php library to generate it).

When I add logo/icon in the QR code, I scaled the logo to fill 1/5 of the image (QR) height (so if the final QR code is 1000x1000, the logo will be 200x200, starting in (400,400) until (600,600) coordinate). Here is an illustration.

1_per_5_illust

One day, I changed the scaling into 1/8 of the QR height (so if the final QR code is 1000x1000, the logo will be 125x125, starting in (438,438) until (563,563) coordinate). Here is an illustration.

1_per_8_illust

The 1/5 scale QR code works well (the system already run from about 4-5 month ago, every day reading 300-1000 QR codes every work day and about 50-200 QR codes every weekend (rough minimum estimate is 4x20x300=24.000 QR codes read until now).

But for some reason, when I use 1/8 scaled logo, the QR code doesn't work (the payload is corrupted) sometimes (not always, but like 60-80% of the time). I know it is corrupted since the payload can be (somewhat) verified by hash by the reader. It is also quite a business critical application so we got a lot complaints when it didn't work.

Now I know that if there's a solution that works, I should just do what works (the 1/5 scale). But I can't help to be curious why this phenomenon happened.

Here is an example of QR code that was generated. Both QR contains exactly same data (same base64 binary). For privacy reason, the logo in QR code is censored/hidden.

QR reader is using this example https://www.sitepoint.com/create-qr-code-reader-mobile-website/ with code sandbox https://codesandbox.io/s/qr-code-scanner-ilrm9?file=/src/qrCodeScanner.js

in that page, they said: "To read QR codes, we’ll be using the JavaScript port of the Java-based image processing library written by ZXing. The JavaScript version was ported by Lazar Laszlo."

Here is 1/5 scaled logo QR. This one works as intended. The payload's CRC hash is 44340d08. The payload is

VGVTcEhjR2RUVWhXMVZsb3ljbVVMWlBldGk2Qm5vRkNXMi9nT3N3QUxZR2c5Znc5L2daYTExNCthOGhBZnMra0ZJa1o1RjJDYi9Mekd5V3lzaW82QmxURjNveHhNOW5Yc0JwYU11RVpZeW9RaGxleWY5YkRlT0JlNnI2ZDhYbzFmMFY2QTZWU0EvbnpBTWJ1dElwVGcrZlQ1TE8ySmt6R1lHaXZ4bjJXUE9nTGQvcEJPRWFBeXZRNVJQYjdwTHBSbHprYzdReEwwR1N1QitBdGZWaTdrQT09

1_per_5_working

Here is 1/8 scaled logo QR. This one did not work (I'm guessing that the payload is corrupted). The payload's CRC hash is a500ee11. The payload is

VGVTcEhjR2RUVWhXMVZsb3ljbVVMWlBldGk2Qm5vRkNXMi9nT3N3QUxZP²c5Znc5L2daYTExNCthOGhBZnMra0ZJa1o1RjJDYi9Mekd5V3lzaW82QmxURjNveHhNOW5Yc0JwYU11RVpZeW9RaGxleWY5YkRlT0JlNnI2ZDhYbzFmMFY2QTZWU0EvbnpBTWJ1dElwVGcrZlQ1TE8ySmt6R1lHaXZ4bjJXUE9nTGQvcEJPRWFBeXZRNVJQYjdwTHBSbHprYzdReEwwR1N1QitBdGZWaTdrQT09

1_per_8_not_working

I noticed that there seems to be superscript-two (square symbol) in 1/8 not working one near UxZP

1

There are 1 answers

0
Kristian On

After reading the QR with ZXing app on android, I found out that the payload is exactly the same for 1/5 scaled logo and 1/8 scaled logo.

So it might just be an issue with the QR reader javascript library that I copy pasted from sitepoint.

So my option was either sticking to 1/5 scale or change my QR reader javascript library.