-
Notifications
You must be signed in to change notification settings - Fork 67
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
Saturate a QR Code Symbol of a given version and EC level #3
Comments
Hi, The maximum amount of bits for each Version + EcLevel is not exposed to public for now, but you could refer to the table in Lines 600 to 649 in 5e3a7ec
Bits::len() , but it does not know if it has overflowed before pushing the terminator (as the EcLevel also affects how much data can be encoded).
If your data has fairly consistent encoding (e.g. all numbers), you could use http://www.qrcode.com/en/about/version.html to determine the upper bound for each symbol. |
Unfortunately, the data is not not constrained to numerals or alphanumerics , so the maximums mentioned on qrcode.com and in the standard do not apply (or rather, they'll lead to wasting usable capacity). For now, I'm brute forcing the optimal encoding via binary search. I'll take a second look at this problem and try to write a function that calculates this value if I manage to find some free time. If it's well-written enough to warrant sharing, I'll submit it to you to freely accept or reject. Thank you for taking the time to write out a detailed response. |
Hello, kennytm. I'm not sure this is the correct venue to raise this issue. I apologies in advance if expressing this issue here is not appropriate.
When encoding is done using
QrCode::with_version
,push_optimal_data
is used internally to dynamically select the best encoding for the segmented data. This makes the maximum amount of data a QR-code symbol can hold dependent on the nature of the encoded data.Is it possible to determine this amount using this crate's public API? If not, is it possible to oversupply data to the encoder and determine how much of that data was successfully encoded?
Background information: I am working on an open source project that serializes binary data as a series of QR Code symbols. I need to keep the number of generated symbols to a minimum. There are constants on symbol dimensions and module size; and hence the requirement for a version limit.
Any help would be greatly appreciated.
The text was updated successfully, but these errors were encountered: