-
Notifications
You must be signed in to change notification settings - Fork 344
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Suboptimal segements chosen, causing bitmap generation to fail #37
Comments
Hi Andrew. Thanks for the kind words. You're right, the optimiser is being too clever, and a single alphanumeric segment would be a more efficient (and more predictable) encoding. We currently use a single byte segment when it's more efficient than multiple segments. I've now added use of a single alphanumeric segment (only if the content allows it), when it's more efficient than multiple segments. let me know if that helps, thanks, skip2 |
I took a look at that and it seems like it would work, but I haven't had a chance to try it yet. Looking through your code taught me a lot about QR codes, even though I already knew enough to do the basic stuff like determine a good ecc. Well done :) In the end I made below change in my vendored version.
I may fork this repo and create a PR, if thats helpful to you in some way. I'll and add this change, and possibly others to make writing "your own" My particular case, generating an insane amount of qr codes:
Anyway, the code has been wonderful to work with. Its easy for me to put something together that does just the 1 thing I want, but you have so much more in there! Feel free to close this, as you see fit. |
@awbacker |
@awbacker This is a similar image that I downloaded from some platforms |
I use the library heavily to generate qr bitmaps (manually creating the image), so thank you for creating it!
The following test case should generate correctly:
6998877
to699E877
causes generation to succeedI noticed that after the call to
encoder.encode
the length is 290 (and somehow numPaddingBits() == -2?). In any case, I am not familiar enough with the code to debug fully yet, but will be giving it a try this afternoon.The multi-segments by default kind of thing is clever, it just appears to be failing in this case. I feel that most users will calculate their version/recovery-level based on the published data lengths which assume single-segment, especially for high volumes.
The text was updated successfully, but these errors were encountered: