When I use Zint library to generate a QR code, the default Mask parameter is automatic. I’ve noticed that the mask parameter changes depending on the data content being used, but sometimes it doesn’t seem to be the optimal choice. For example , I use the URL link data to generate the code, http://m.t3315.com/?fw=8984727225806574 , Zint uses mask 3, but the best option is mask 5, Could this problem be caused by some parameter I didn’t set correctly? Are there any ways to make the mask selection more precise?
Hi Kevin, I get the automatic mask 3 on that data when I use Level M error correction, is that what you're using?
You can use the
--verboseswitch to list the mask scores:which prints the following mask scores (lower is better):
So Zint selects mask 3. Why do you think mask 5 is best?
Regards, Martin
Hi Martin,thanks for your quick reply. In fact, the customer considers Mask 5 the optimal choice. Our customer uses two barcode generation software tools: Zint and Barcode Studio. With identical input data( http://m.t3315.com/?fw=8984727225806574 ), error correction level set to M, and mask mode set to Automatic for both, Zint generates the QR code using Mask 3 while Barcode Studio uses Mask 5. The customer’s barcode scanner expects the result with Mask 5. This discrepancy is rather confusing. I generated QR codes using Mask 3 and Mask 5 respectively. The difference between them is minor, though Mask 5 appears somewhat sparser.
Hi, I have a demo version of TEC-IT Barcode Studio (version 17.2.1.32162) - which I assume you're referring to - and I just tried it now and it uses mask 0 by default?
I notice that BWIPP uses mask 0 by default also.
Unfortunately, what a generator considers to be the best mask can differ, due to the difficulty in interpreting the mask scoring algorithm given in the standard. (Generators can also differ in the encodation used for identical data.)
Regardless, the customer's barcode scanner should accept either. The mask isn't really that important, it's there to prevent badly degenerate patterns.
Attached is the result I get from TEC-IT Barcode Studio.
Last edit: kevinZhang 2026-10-19
Hi Martin, we use the simple input data 012 to generate QR codes, with the error correction level set to M and mask mode set to Automatic, Zint defaults to Mask 6 while Barcode Studio selects Mask 2. I tested with different datasets. For some inputs, the resulting QR codes match, but quite often the two tools pick different masks even with the same data, it is strange。
See above, but also just tried that data in TEC-IT Barcode Studio and it selected mask 0 by default? Maybe we're talking about different products.
Here is the 012 data code generated by mask6 and mask3 seperately
Hi Martin, I am using Barcode Studio 17.1. For QR codes, Barcode Studio offers two modes: QR-Code and QR-Code (JIS). I tested with the same data, and QR-Code and QR-Code (JIS) use different masks for generation. The customer requires QR codes generated under the QR-Code (JIS) mode. Is there a way for Zint to produce output consistent with QR-Code (JIS) mode?
Ah ok, that explains the different mask results I was getting.
Yes, so TEC-IT Barcode Studio uses a different default mask depending on whether QR Code or QR Code (JIS) is used, on the exact same data with the exact same codewords.
QR Code (JIS) is based on the original "JIS / ’97 version" according to TEC-IT's manual, which was published by AIM and which I don't have, so I don't know what mask algorithm was specified there. But if we believe the TEC-IT results then it is different than the ISO one.
I think that underlines how masks really aren't that important, as long as degenerate cases are avoided.
If your customers insist on producing the exact same results as TEC-IT QR Code (JIS), then I'm afraid Zint will not achieve that.
I suppose, the JIS-version uses SHIFT-JIS as default encoding, the other ISO8859-1.
This changes the content for non-ASCII data and thus results in other masks.
Remark that the JIS version si highly outdated and does not conform to any present standard.
Harald
Last edit: Harald Oehlmann 2026-10-20
Hi Harald, yes, it's default encoding is Shift-JIS.
I do have the old ISO/IEC 18004:2000 standard, which is probably very close to the AIM '97 version (its default encoding is also Shift-JIS). A difference I notice in the mask scoring algorithm is that in test 3 for the "1:1:3:1:1" pattern it doesn't insist on 4 light modules preceding/following the pattern, which modern ISO standards do, so maybe that's the reason for the difference in the TEC-IT JIS and ISO masks.
Yes, great. By chance, ISO/IEC JTC1 SC31 WG1 meeting is today and we will revise 18004.
Main point is the reduction of the quiet zone to 1 module and the quality tests.
Take care,
Harald