This C# demo code will read all the Code 39 barcodes in the image file "code39-csharp.gif".
How to Optimize Code 39 Barcode Reading Effect in C# Class
To optimize Code 39 recognition effect, we also provide other ways of Code 39 barcode scanning. This is suitable especially when the source image file is in a large size, like 4mb per image.
1. Decode the Maximum One Code 39 from Image Source
If you need to scan the maximum one Code 39 in a image source (per image, page in tiff or pdf document), please set maxOneBarcodePerPage to true.
In this condition, our Code 39 C#.NET Barcode Scanning Component will stop reading the barcode as soon as it detects one Code 39 barcode.
On the contrary, if this property is false (default value), our Code 39 C#.NET Barcode Scanning Component 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 Code 39 barcode is always located on specific area in image file, you can customize Code 39 C#.NET Barcode Reader Component 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 C# demo code explains how to read Code 39 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();
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);