Incorrect Rectangle error


Hello - when I try to read bar/QR codes from the attached image, I get an exception every time that says “Incorrect rectangle”.

I’m trying to read any codes from the entire image, so this error is unexpected. (I have not specified any rectangles, so this seems to be an internal bug.)

JPG and PNG versions of the image are attached - the error happens with both.asposeBarCodeErrorJpg.jpg (1.2 MB)
asposeBarCodeErrorPng.png (988.9 KB)

The code I’m using is very basic:
string imageFilename = “PATH TO IMAGE HERE”;
List barcodes = new List();
using (BarCodeReader reader = new BarCodeReader(imageFilename))
while (reader.Read())
return barcodes.ToArray();

Thank you!



Thanks for the image files and sample code.

After an initial test, I am able to reproduce the issue (although I do not get exception but it could not read barcodes (if exists)). I found that reading barcode text from your images failed. The recognition problem might be due to low images’ dpi. I have logged a ticket with an id “BARCODENET-37289” for your issue. We will investigate and look into it soon.

Once we have an update on it, we will let you know.


I forgot to mention, I’m using version 17.7 of Aspose.BarCode. Can you verify whether an exception is thrown on that version?
(I don’t expect any barcode to be found in this image; I just want to not get the exception.)

Thanks again.



Sorry for the confusion, I thought there were some barcode in the images you attached. Please try using our latest version/fix (e.g Aspose.BarCode for .NET v19.8). We did include enhancement regarding barcode recognition and generation to APIs later on in newer versions which do not throw exceptions.

Please note, we cannot evaluate issues in older versions. Neither we can include any enhancements or fixes to older API. The fixes are based on latest APIs set only. So, there is no other alternative but to upgrade to latest version of the product.

PS. I have closed the ticket as it is not an issue.


Thank you - I can confirm that the issue is fixed on version 19.8.



Good to know that your issue is sorted out by using latest version/fix. Feel free to contact us any time if you have further queries or issue, we will be happy to assist you soon.