How to Adjust Reading Speed

This article was translated from English: Does it need improvement?
Translated
View the article in English

Accuracy is essential for scalability and reading large sets of barcodes, but how a barcode reader allocates its resources and how efficiently it is also must be considered. Depending on the input images and the image quality themselves, it is vital that developers decide on how a barcode reader should approach and read the images, such as whether to skip image preprocessing if the images are clear, or going with a more resource intensive option to improve the reading accuracy of the barcode reader.

IronBarCode provides you with the flexibility to choose the speed and accuracy of the barcode processing detail, allowing you to fine-tune and control every aspect of the process. You can make the decision based on the input images you have and the resources you want to allocate.

The article below would be a general guideline on the most optimal situation for deciding which reading speed to use. We'd use a sample set of QR codes to give brief examples of how changing the reading speed affects the results.

Quickstart: Read a Barcode with Balanced Speed

Use IronBarcode’s BarcodeReaderOptions to instantly set the Speed level for your scan. This example shows how developers can quickly read barcodes using the Balanced setting for a fast and reliable result.

Nuget IconGet started making PDFs with NuGet now:

  1. Install IronBarcode with NuGet Package Manager

    PM > Install-Package BarCode

  2. Copy and run this code snippet.

    var results = IronBarCode.BarcodeReader.Read("path/to/image.png", new IronBarCode.BarcodeReaderOptions { Speed = IronBarCode.ReadingSpeed.Balanced });
  3. Deploy to test on your live environment

    Start using IronBarcode in your project today with a free trial
    arrow pointer


Reading Speed

Within IronBarCode, developers can set the ReadingSpeed to four different options: Faster,Balanced, Detailed, and ExtremeDetail. We'll go through each of these options, and a sample set as a benchmark on how the ReadingSpeed value affects the process's output. The sample set contains a mix of degraded barcode images and clearer images, heavily leaning towards severely degraded images to illustrate the functionality of the library.

We'll also use a popular .NET benchmark library to benchmark the times and memory usage, illustrating how each option compares to the others and identifying the ideal scenarios and situations for each reading speed option. We'll display the code for benchmarking with the library, and also a more straightforward way of deducing the amount of degraded barcode IronBarCode could read.

Faster Speed Option

The first value is Faster. In general, setting the Speed property to this value enables the fastest barcode reading with minimal resources, but it comes with a trade-off of reduced accuracy. The process would skip image preprocessing and is generally recommended if the image itself is already sharp and clear before being input into the process.

For this example, we set the Speed property to ReadingSpeed.Faster, imported the directory containing all the barcodes, and printed out any barcodes found, along with their value and type and the number of barcodes found from each image.

:path=/static-assets/barcode/content-code-examples/how-to/reading-speed-option-faster.cs
using IronBarCode;
using System;
using System.Diagnostics;
using System.IO;
using System.Linq;

var optionsFaster = new BarcodeReaderOptions
{
    Speed = ReadingSpeed.Faster
};

// Directory containing PDF files
string folderPath = @"YOUR_FILE_PATH";

// Get all PDF files in the directory
var pdfFiles = Directory.GetFiles(folderPath, "*.jpg");

int countFaster = 0;
var stopwatch = Stopwatch.StartNew();
foreach (var file in pdfFiles)
{
    // Read the barcode
    var results = BarcodeReader.Read(file, optionsFaster);

    if (results.Any())
    {
        Console.WriteLine($"Barcode(s) found in: {Path.GetFileName(file)}");
        foreach (var result in results)
        {
            Console.WriteLine($"  Value: {result.Value}, Type: {result.BarcodeType}");
            countFaster++;
        }
    }
    else
    {
        Console.WriteLine($"No barcode found in: {Path.GetFileName(file)}");
    }
}

stopwatch.Stop();

// Print number of images the barcode reader could decode
Console.WriteLine($"Faster could read = {countFaster} out of {pdfFiles.Length} in {stopwatch.ElapsedMilliseconds}ms");
IRON VB CONVERTER ERROR developers@ironsoftware.com
$vbLabelText   $csharpLabel

The Faster detected 146 barcode results out of 430 in 25 seconds. This option is quick and can decode around 33.95% of the barcode. Although fast, this method is generally only suited for images with pristine conditions.

Balanced Speed Option

The Balanced value balances accuracy and read performance. When applying this setting, IronBarcode applies light processing to the image to clarify the barcode area, make it stand out for the barcode reader to detect, and make it easier to read. In general, this is the recommended setting for most modern-day images, as the light processing should suffice to produce accurate results.

Let's use the same images and showcase how the Balanced value affects the output results.

:path=/static-assets/barcode/content-code-examples/how-to/reading-speed-option-balanced.cs
using IronBarCode;
using System;
using System.Diagnostics;
using System.IO;
using System.Linq;

var optionsFaster = new BarcodeReaderOptions
{
    Speed = ReadingSpeed.Balanced
};

// Directory containing PDF files
string folderPath = @"YOUR_FILE_PATH";

// Get all PDF files in the directory
var pdfFiles = Directory.GetFiles(folderPath, "*.jpg");

int countFaster = 0;
var stopwatch = Stopwatch.StartNew();
foreach (var file in pdfFiles)
{
    // Read the barcode
    var results = BarcodeReader.Read(file, optionsFaster);

    if (results.Any())
    {
        Console.WriteLine($"Barcode(s) found in: {Path.GetFileName(file)}");
        foreach (var result in results)
        {
            Console.WriteLine($"  Value: {result.Value}, Type: {result.BarcodeType}");
            countFaster++;
        }
    }
    else
    {
        Console.WriteLine($"No barcode found in: {Path.GetFileName(file)}");
    }
}

stopwatch.Stop();

// Print number of images the barcode reader could decode
Console.WriteLine($"Balanced could read = {countFaster} out of {pdfFiles.Length} in {stopwatch.ElapsedMilliseconds}ms");
IRON VB CONVERTER ERROR developers@ironsoftware.com
$vbLabelText   $csharpLabel

The Balanced detected 237 barcode results out of 430 in 43 seconds. It provides a 55.11% accuracy improvement over the Faster option, with only a slight increase in time. The Balanced option maintains an efficient balance between memory and speed, making it the ideal choice for most situations, and it's the recommended starting point.

Detailed Speed Option

In scenarios where the images are heavily blurred or distorted and situations where the Balanced option is unable to clearly detect and produce results, developers may opt to use the Detailed property to apply medium pre-processing to the images to clarify the barcode area even further and clear up more digital noise for the barcode reader to detect the barcode.

Let's apply the Detailed setting to the Speed property this time and see if it affects the overall output of the images.

:path=/static-assets/barcode/content-code-examples/how-to/reading-speed-option-detailed.cs
using IronBarCode;
using System;
using System.Diagnostics;
using System.IO;
using System.Linq;

var optionsFaster = new BarcodeReaderOptions
{
    Speed = ReadingSpeed.Detailed
};

// Directory containing PDF files
string folderPath = @"YOUR_FILE_PATH";

// Get all PDF files in the directory
var pdfFiles = Directory.GetFiles(folderPath, "*.jpg");

int countFaster = 0;
var stopwatch = Stopwatch.StartNew();
foreach (var file in pdfFiles)
{
    // Read the barcode
    var results = BarcodeReader.Read(file, optionsFaster);

    if (results.Any())
    {
        Console.WriteLine($"Barcode(s) found in: {Path.GetFileName(file)}");
        foreach (var result in results)
        {
            Console.WriteLine($"  Value: {result.Value}, Type: {result.BarcodeType}");
            countFaster++;
        }
    }
    else
    {
        Console.WriteLine($"No barcode found in: {Path.GetFileName(file)}");
    }
}

stopwatch.Stop();

// Print number of images the barcode reader could decode
Console.WriteLine($"Detailed could read = {countFaster} out of {pdfFiles.Length} in {stopwatch.ElapsedMilliseconds}ms");
IRON VB CONVERTER ERROR developers@ironsoftware.com
$vbLabelText   $csharpLabel

The Detailed detected 237 barcode results out of 430 in 5 minutes and 30 seconds. Its success rate of 55.11% in a severely degraded barcode dataset is a testament to its accuracy. However, the trade-off is significant, as the process time is increased by a large margin. Therefore, it is crucial that this option be used exclusively for degraded barcode images.

ExtremeDetail Speed Option

The final setting of the Speed property is ExtremeDetail, which applies heavy processing to the barcode image so that the reader can read it, generally reducing IronBarcode's reading performance. This option is ideal for scanning large amounts of barcodes within one input file that is also unclear or blurry in batches. The operation is CPU-intensive and should be used as a last resort when the other options aren't producing the desired results.

Let's apply the ExtremeDetail setting to the Speed property to see if it affects the outcome.

:path=/static-assets/barcode/content-code-examples/how-to/reading-speed-option-extreme-detailed.cs
using IronBarCode;
using System;
using System.Diagnostics;
using System.IO;
using System.Linq;

var optionsFaster = new BarcodeReaderOptions
{
    Speed = ReadingSpeed.ExtremeDetail
};

// Directory containing PDF files
string folderPath = @"YOUR_FILE_PATH";

// Get all PDF files in the directory
var pdfFiles = Directory.GetFiles(folderPath, "*.jpg");

int countFaster = 0;
var stopwatch = Stopwatch.StartNew();
foreach (var file in pdfFiles)
{
    // Read the barcode
    var results = BarcodeReader.Read(file, optionsFaster);

    if (results.Any())
    {
        Console.WriteLine($"Barcode(s) found in: {Path.GetFileName(file)}");
        foreach (var result in results)
        {
            Console.WriteLine($"  Value: {result.Value}, Type: {result.BarcodeType}");
            countFaster++;
        }
    }
    else
    {
        Console.WriteLine($"No barcode found in: {Path.GetFileName(file)}");
    }
}

stopwatch.Stop();

// Print number of images the barcode reader could decode
Console.WriteLine($"ExtremeDetail could read = {countFaster} out of {pdfFiles.Length} in {stopwatch.ElapsedMilliseconds}ms");
IRON VB CONVERTER ERROR developers@ironsoftware.com
$vbLabelText   $csharpLabel

The ExtremeDetail option, with its ability to identify 313 out of 430 barcode images, takes an average of 10 minutes per run. It's a powerful tool, suitable only as a last resort for severely degraded options due to its high resource consumption. It can find the most barcodes with an impressive 72.79% accuracy in a dataset of severely degraded barcodes, but it's still recommended to perform pre-processing on them before passing them through the barcode finder.

Summary Table

Mode Barcodes Found Mean Time Time per File GC Pressure Accuracy Gain
Faster 147/430 (33.95%) 25 s 0.058 s High (Gen2: 177K) Baseline
Balanced 237/430 (55.11%) 43 s 0.1 s High (Gen2: 151K) +62.32% vs Faster
Detailed 237/430 (55.11%) 5.50 min 0.767 s Very High (Gen2: 297K) +0% vs Balanced
ExtremeDetail 313/430 (72.79%) 10.14 min 1.414 s Extreme (Gen2: 4.74M) +32.08% vs Detailed

Choosing the Right Speed

After the brief comparison above, and the different scenarios mentioned above, developers should, in general, try from the lowest setting Faster and slowly progress through Balanced, Detailed, ExtremeDetail to see if there are any significant discrepancies between the output. Regarding scalability with using IronBarCode, in most scenarios, Balanced would be more than often to go through everything, and developers should only use the Detailed, ExtremeDetail, depending on how heavily distorted the images are. Furthermore, although both of these options applies medium and heavy processing to images when using Detailed and ExtremeDetail, there are scenarios where it's more worthwhile to split the process into two and apply image filters manually before placing it into the barcode reader rather than using a single process. For more information on processing images for the barcode reader, please refer to this here. As a general recap, here's a brief table and summary of the situations where each varying speed is appropriate.

Decision Chart

Output

常见问题解答

IronBarcode中的读取速度选项是什么?

IronBarcode允许您根据应用程序的需要调整读取速度,优化为更快的处理或更高的读取准确性。

如何在IronBarcode中配置条形码读取速度?

您可以通过设置条形码读卡器中的特定参数来配置IronBarcode中的读取速度,允许您优先考虑速度或准确性。

为什么我需要在IronBarcode中调整读取速度?

调整读取速度可以帮助平衡性能和准确性,这在需要高速处理或精确条形码检测的应用中至关重要。

在IronBarcode中是否可以同时实现高精度和快速读取速度?

虽然IronBarcode允许在速度和准确性之间进行可定制的平衡,但实现完美组合可能取决于具体使用案例和条形码复杂性。

在IronBarcode中选择读取速度设置的因素是什么?

因素如被扫描条形码的类型、图像质量和操作环境等会影响在IronBarcode中选择读取速度设置。

我可以在IronBarcode中动态更改读取速度设置吗?

是的,您可以在IronBarcode中动态调整读取速度设置,以适应不同的扫描条件和需求。

读取速度如何影响IronBarcode中的条形码扫描性能?

IronBarcode中的读取速度设置会影响条形码的处理速度,较高的速度可能减少准确性,而较低的速度则提高精度。

Curtis Chau
技术作家

Curtis Chau 拥有卡尔顿大学的计算机科学学士学位,专注于前端开发,精通 Node.js、TypeScript、JavaScript 和 React。他热衷于打造直观且美观的用户界面,喜欢使用现代框架并创建结构良好、视觉吸引力强的手册。

除了开发之外,Curtis 对物联网 (IoT) 有浓厚的兴趣,探索将硬件和软件集成的新方法。在空闲时间,他喜欢玩游戏和构建 Discord 机器人,将他对技术的热爱与创造力相结合。

准备开始了吗?
Nuget 下载 1,935,276 | 版本: 2025.11 刚刚发布