Unable To Read QR Barcode

I have an image with a QR barcode in it. My phone can read the barcode, but the BarCodeReader cannot. I will attach the file - testcop.png (203.3 KB)

I am using the C# DLL 18.7.0.0. Here is my code (I have tried many different manual hints and quality levels):

public List<string> GetBarcodesFromImage(System.Drawing.Image image)
{
    var licfilePath = HttpContext.Current.Server.MapPath("~/Resources/Aspose.BarCode.lic");
    License l = new License();
    l.SetLicense(licfilePath);
    System.Drawing.Bitmap bmp = (System.Drawing.Bitmap)image;
    List<string> barcodes = new List<string>();

    //using (Aspose.BarCodeRecognition.BarCodeReader barReader = new Aspose.BarCodeRecognition.BarCodeReader(bmp))
    using (Aspose.BarCode.BarCodeRecognition.BarCodeReader barReader = new Aspose.BarCode.BarCodeRecognition.BarCodeReader(bmp, Aspose.BarCode.BarCodeRecognition.DecodeType.QR))
    {
        barReader.RecognitionMode = Aspose.BarCode.BarCodeRecognition.RecognitionMode.MaxBarCodes;
        //barReader.ManualHints = Aspose.BarCode.BarCodeRecognition.ManualHint.UseRestoration;

        while (barReader.Read())
        {
            string code = barReader.GetCodeText();
            barcodes.Add(code);
        }
    }

    return barcodes;
}

@grahamlaight,

We were able to reproduce the issue and it has been logged into our issue tracking system as BARCODENET-36945. We will investigate it further and will keep you updated on this issue in this thread.

The issues you have found earlier (filed as BARCODENET-36945) have been fixed in this update. This message was posted using BugNotificationTool from Downloads module by muhammadahmad

@grahamlaight

The issue has been resolved and you use the following code sample:

using (BarCodeReader reader = new BarCodeReader(fileName, DecodeType.AllSupportedTypes))
{
    List<string> lCodetexts = new List<string>();
    while (reader.Read())
        lCodetexts.Add(reader.GetCodeText());

    Assert.AreEqual(1, lCodetexts.Count);
    Assert.Contains("50711434", lCodetexts);
}
1 Like