This C# sample code will decode all the QR Code barcodes in the file "qrcode-csharp.gif".
How to Imporve QR Code Barcode Recognition in Visual C#
To provide better QR Code recognition service, we also design the way to optimize your QR Code barcode reading & decoding. This is suitable when the source image file is in a large size, like 4mb per image.
1. Read the Maximum One Barcode from Image Source
If you need to scan the maximum one barcode in your target image source (per image, page in tiff or pdf document), please set maxOneBarcodePerPage to true.
In this condition, our QR Code C#.NET Barcode Reader DLL will stop reading the barcode as soon as it detects one QR Code barcode.
On the contrary, if this property is false (default value), our QR Code C#.NET Barcode Reader DLL will use total 5 algorithms and each will read the whole source file from 4 directions.
2. Read the Partial Image of a Source File
If the QR Code barcode image is always located on specific area in image file, you can customize our C#.NET Barcode Reader Library to read that area only. And this is a good way to save a lot of reading time, CPU and memory usage.
Please just specify the left top point and right bottom point of the area (the point X, Y values are expressed in percentage of the whole image, so image most left top point is (0%, 0%), and most right bottom point is (100%, 100%).
The following free Visual C# code explains how to read QR Code from a specified area of an image source. Let's take top 20% and bottom 20% of the image as an example.
OptimizeSetting setting = new OptimizeSetting();
setting.setMaxOneBarcodePerPage(true);
ScanArea top20 = new ScanArea(new PointF(0.0F, 0.0F), new PointF(100.0F, 20.0F));
ScanArea bottom20 = new ScanArea(new PointF(0.0F, 80.0F), new PointF(100.0F, 100.0F));
List<ScanArea> areas = new List<ScanArea>(); areas.Add(top20); areas.Add(bottom20);