QR Codes No Longer Readable After upgrade to 2021.6.0

We utilize the Aspode barcode library to generate QR Codes for directing faxes to the proper buckets on our network. We just tried to upgrade from 19.11.0 to 2021.6.0, but the ZBar reader on our server cannot read the new QR Codes generated by the updated library. We have found that some mobile QR readers can read the new QR Codes, but others can’t. We want to remain current with your product, but can’t make the upgrade until this is resolved. Any help would be appreciated.

Can you provide example of unreadable QR code and code which generates the QR code. ZBar reader might have problem with ECI support, so don’t use this mode.

Hi Alexander,

Thanks for responding. We are currently using Bytes mode, not ECI, so that wouldn’t be the issue.

Attached are two examples of QR codes that our system is not reading.

UnreadableQR1.pdf (8.25 KB)

UnreadableQR2.pdf (8.32 KB)

@mickcates,
Please share the runnable sample code that is used to create this QR code for our analysis.

See code below.

public Image GenerateCode(string codeText) {

AsposeBarcodeLicense.LoadLicense();

using (BarcodeGenerator generator = new BarcodeGenerator(EncodeTypes.QR)) {

generator.Parameters.Barcode.QR.QrEncodeType = QREncodeType.ForceQR;

generator.Parameters.Barcode.QR.QrEncodeMode = QREncodeMode.Bytes;

generator.Parameters.Barcode.QR.QrErrorLevel = QRErrorLevel.LevelH;

generator.Parameters.Barcode.AutoSizeMode = AutoSizeMode.Interpolation;

generator.Parameters.Barcode.BarCodeWidth.Pixels = 300;

generator.Parameters.Barcode.BarCodeHeight.Pixels = 300;

generator.Parameters.Barcode.CodeTextParameters.Location = CodeLocation.None;

generator.Parameters.Border.Visible = false;

generator.Parameters.Barcode.Padding.Top.Pixels = 0;

generator.Parameters.Barcode.Padding.Bottom.Pixels = 0;

generator.Parameters.Barcode.Padding.Left.Pixels = 0;

generator.Parameters.Barcode.Padding.Right.Pixels = 0;

generator.CodeText = codeText;

Bitmap qrCode = generator.GenerateBarCodeImage();

return qrCode;

}

@mickcates,
I have tried this sample code with the latest version Aspose.BarCode for .NET 21.6 but could not observe any issue in the output QRCode as it is successfully read by different barcode scanners. Could you please ensure that the latest version is used in the testing? Here is the sample code and generated QR code that is readable.

string codeText = "ABCD12345";
using (BarcodeGenerator generator = new BarcodeGenerator(EncodeTypes.QR))
{
    generator.Parameters.Barcode.QR.QrEncodeType = QREncodeType.ForceQR;
    generator.Parameters.Barcode.QR.QrEncodeMode = QREncodeMode.Bytes;
    generator.Parameters.Barcode.QR.QrErrorLevel = QRErrorLevel.LevelH;
    //generator.Parameters.Barcode.AutoSizeMode = AutoSizeMode.Interpolation;
    //generator.Parameters.Barcode.BarCodeWidth.Pixels = 300;
    //generator.Parameters.Barcode.BarCodeHeight.Pixels = 300;
    generator.Parameters.AutoSizeMode = AutoSizeMode.Interpolation;
    generator.Parameters.ImageWidth.Pixels = 300;
    generator.Parameters.ImageHeight.Pixels = 300;
    generator.Parameters.Barcode.CodeTextParameters.Location = CodeLocation.None;
    generator.Parameters.Border.Visible = false;
    generator.Parameters.Barcode.Padding.Top.Pixels = 0;
    generator.Parameters.Barcode.Padding.Bottom.Pixels = 0;
    generator.Parameters.Barcode.Padding.Left.Pixels = 0;
    generator.Parameters.Barcode.Padding.Right.Pixels = 0;
    generator.CodeText = codeText;
    Bitmap qrCode = generator.GenerateBarCodeImage();
    qrCode.Save("output.png", ImageFormat.Png);
}

The QR codes generated by the code I provided definitely aren’t readable for us when we use 21.6. When we updated the code as noted below, however, the codes are readable. Can you help us understand why we needed to change the image height to get it to work properly?

Thanks

public Image GenerateCode(string codeText) {

AsposeBarcodeLicense.LoadLicense();

using (BarcodeGenerator generator = new BarcodeGenerator(EncodeTypes.QR)) {

generator.Parameters.Barcode.QR.QrEncodeType = QREncodeType.ForceQR;

generator.Parameters.Barcode.QR.QrEncodeMode = QREncodeMode.Bytes;

generator.Parameters.Barcode.QR.QrErrorLevel = QRErrorLevel.LevelH;

generator.Parameters.AutoSizeMode = AutoSizeMode.Interpolation;

generator.Parameters.ImageWidth.Pixels = 300;

generator.Parameters.ImageHeight.Pixels = 287;

generator.Parameters.Barcode.CodeTextParameters.Location = CodeLocation.None;

generator.Parameters.Border.Visible = false;

generator.Parameters.Barcode.Padding.Top.Pixels = 0;

generator.Parameters.Barcode.Padding.Bottom.Pixels = 0;

generator.Parameters.Barcode.Padding.Left.Pixels = 0;

generator.Parameters.Barcode.Padding.Right.Pixels = 0;

generator.CodeText = codeText;

Bitmap qrCode = generator.GenerateBarCodeImage();

return qrCode;

}

}

Interpolation mode tries to precisely fit barcode size to image size, in this way cell position must be precised with advanced algorithms. Some barcode readers have these algorithms, some don’t have. You can use AutoSizeMode.Nearest to avoid this situation or use size in inches/milliliters with 300+ dpi.

Thank you for the explanation. That is helpful. Does it make sense that this was not an issue in our previous version, since we didn’t have the problem until we updated?

The barcode writing algorithms could slightly be changed, so previous version wonderfully works and new does not. But Interpolation mode works well only with high dpi resolutions.

Understood. Thank you.