Closed RolfBremer closed 11 months ago
QR-Codes are masked with a masking pattern, to create a code that is easy to read for scanners. Version 0.2.0 of codetastic
uses a simplified algorithm to calculate the best pattern, to speed up the creation process. But this approach will not always produce the most readable code (though they are correct qr-codes). Using the original algorithm did take considerable time for medium to large codes.
I'm thinking of ways to get better result while still keeping rendering times feasible. Maybe using the original algorithm up to a certain size and switching to the approximation for larger versions.
For now, you could set the masking pattern manually with the mask
argument. You can get the best mask from online generators like this one.
In your example, mask: 2
is used by the linked generator (while mask: 6
is used in the first code generated by codetastic
).
#[
#import "@preview/codetastic:0.1.0"
#h(1fr)
#box[#codetastic.qrcode(width: 42pt, "Dies ist ein dichter QR-Code mit vielen Informationen")]
#h(1fr)
]
#[
#import "@preview/codetastic:0.2.0"
#h(1fr)
#box[#codetastic.qrcode(width: 42pt, "Dies ist ein dichter QR-Code mit vielen Informationen", mask:6)]
#h(1fr)
]
#[
#import "@preview/codetastic:0.2.0"
#h(1fr)
#box[#codetastic.qrcode(width: 42pt, "Dies ist ein dichter QR-Code mit vielen Informationen", mask:2)]
#h(1fr)
]
Some other things I noticed in your screenshot:
I just submitted version 0.2.2 that fixes the last two issues.
The masking pattern thing will take some more time to optimize the code.
Cool, I will look into it! Thanks!
Great, Version 0.2.2 works perfectly. Reading occurs instantly! The new code appears a lot smaller than in version 0.1.0, also both have a width of 42pt.
I do not think, that is a problem. I see this Issue solved. Thanks again!
The smaller code size is intended. The sizing before was wrong, because the quiet zone (white space around the code) was ignored while calculating the size. The qr-code spec suggests to have a quiet-zone of at least four modules around the code.
If you want the actual codes to be 42pt, either set quiet-zone to 0 or set the width to 53.58pt, to take the quiet-zone into account.
Thanks for this phantastic package!
I noticed that the new version produces QR-Codes that are harder to read. Here is a sample I created to test this:
The code to generate the codes is here:
Any idea what´s wrong?