BinaryEye icon indicating copy to clipboard operation
BinaryEye copied to clipboard

Generated QRCode default margin is too narrow

Open QJKX opened this issue 10 months ago • 2 comments

A standard compliant QRCode has a margin of 4+ modules - the "quiet zone". https://www.qrcode.com/en/howto/code.html

Currently BinaryEye defaults to a 4 pixel margin - too narrow because modules:pixels is not 1:1.

~Zxing defaults to a 4 module margin, which is ideal - it dynamically chooses the perfect number of pixels depending on the code size. BinaryEye requires a MARGIN value, so it's not possible to use that default Zxing behaviour.~

https://github.com/zxing/zxing/blob/6ae11863c7082cfeb62fa5075a488ec9588a01e6/core/src/main/java/com/google/zxing/qrcode/QRCodeWriter.java#L73

QJKX avatar Feb 10 '25 00:02 QJKX

ZXing can turn off scaling so modules:pixels is 1:1 (untested)

https://github.com/zxing/zxing/blob/6ae11863c7082cfeb62fa5075a488ec9588a01e6/core/src/main/java/com/google/zxing/qrcode/QRCodeWriter.java#L86C1-L87C47

   * <p>If no scaling is required, both {@code width} and {@code height}
   * arguments should be non-positive numbers.

For my use case 1:1 is fine - anything I use them for scales automatically.

QJKX avatar Feb 10 '25 00:02 QJKX

This is known issue that stems from ZXingCpp using just pixels for measuring the margin 😬 Please note that this app is using ZXingCpp, not ZXing.

This issue is on my list of improvements, and I hope to fix it in the future.

markusfisch avatar Feb 10 '25 17:02 markusfisch