Http://frankman.blog.163.com/blog/static/3780069920113169555147/
We need to use two-dimensional code codes to store more compress information, and choose to download open-source tools from the Internet for reuse based on the principle of putting people behind the tree and enjoying the cold. Therefore, I chose a set of two-dimensional code implementation developed by the Japanese. Many examples are provided on the Internet. However, many jar packages only contain the function of parsing the QR code, rather than generating the QR code.
Javaeye has an integrated jar package, but I have forgotten it from that post. Here I will download an integrated jar package. Hey, http://www.yimuhe.com/filedown.php? Id = 167916
The examples on the Internet are good, but the rules and key points of qrcode QR code generation are not described in detail. For example, why does the length of the character set be less than 128 When a QR code is generated. You need to know that the size of the QR code information is large: it can contain up to 1850 uppercase letters, 2710 digits, 1108 bytes, or more than 500 Chinese characters, which is about dozens of times higher than the size of common barcode information. If the number of compressed content is limited to 128, what are the advantages of the QR code?
After multiple tests, we found that the amount of characters contained in the QR code is determined by the qrcodeversion setting value. When qrcodeversion is set to 20, it can contain more than 300 bytes.
If you think this solves the problem, you are wrong. If the value of qrcodeversion is modified, only the character set capacity is solved, but the generated image cannot be decoded. However, when the character capacity is limited to less than 128 characters, it can be decoded normally. Are there so many problems with Japanese writing? I can only find a few difficult ones on the Internet, but I cannot find a solution.
When you accidentally open the generated image, you can see the problem. The size of the generated QR code image varies according to the compressed information, the example provided on the Internet is through the new bufferedimage (139,139, bufferedimage. type_int_rgb); to create an image object. The default size of the image is 139*139, which is suitable for qrcodeversion 7. By setting the image size to 300*300, the qrcodeversion is 20 and can be decoded normally.
The range value of qrcodeversion is 0-40. 0 indicates that the compressed amount of information will be determined based on the actual input value. Only the maximum limit is allowed, and the image size will be automatically scaled based on the amount of information. The range between 1 and 40 has a fixed upper limit on the amount of information, and the size of the image will be fixed on the same size, and will not change according to the amount of information.
The above are some of the problems encountered when using the qrcode tool.