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

Preguntas Frecuentes

¿Cuáles son las opciones de velocidad de lectura en IronBarcode?

IronBarcode te permite ajustar la velocidad de lectura para adecuarse a las necesidades de tu aplicación, optimizando para un procesamiento más rápido o una mayor precisión en la lectura de códigos de barras.

¿Cómo puedo configurar la velocidad de lectura de códigos de barras en IronBarcode?

Puedes configurar la velocidad de lectura en IronBarcode ajustando parámetros específicos en la configuración del lector de códigos de barras, permitiéndote priorizar la velocidad o la precisión.

¿Por qué necesitaría ajustar la velocidad de lectura en IronBarcode?

Ajustar la velocidad de lectura puede ayudar a equilibrar el rendimiento y la precisión, lo cual es crucial en aplicaciones donde se requiere ya sea un procesamiento a alta velocidad o una detección precisa de códigos de barras.

¿Es posible lograr alta precisión y velocidad de lectura rápida simultáneamente en IronBarcode?

Aunque IronBarcode permite un equilibrio personalizable entre velocidad y precisión, lograr la combinación perfecta puede depender del caso de uso específico y la complejidad del código de barras.

¿Qué factores influyen en la elección de las configuraciones de velocidad de lectura en IronBarcode?

Factores como el tipo de códigos de barras que se están escaneando, la calidad de las imágenes y el entorno operativo pueden influir en la elección de las configuraciones de velocidad de lectura en IronBarcode.

¿Puedo cambiar dinámicamente las configuraciones de velocidad de lectura en IronBarcode?

Sí, puedes ajustar dinámicamente las configuraciones de velocidad de lectura en IronBarcode para adaptarse a diferentes condiciones y requisitos de escaneo.

¿Cómo afecta la velocidad de lectura al rendimiento del escaneo de códigos de barras en IronBarcode?

Las configuraciones de velocidad de lectura en IronBarcode afectan la rapidez con la que se procesan los códigos de barras, con velocidades más altas reduciendo potencialmente la precisión y velocidades más bajas mejorando la precisión.

Curtis Chau
Escritor Técnico

Curtis Chau tiene una licenciatura en Ciencias de la Computación (Carleton University) y se especializa en el desarrollo front-end con experiencia en Node.js, TypeScript, JavaScript y React. Apasionado por crear interfaces de usuario intuitivas y estéticamente agradables, disfruta trabajando con frameworks modernos y creando manuales bien ...

Leer más
¿Listo para empezar?
Nuget Descargas 1,935,276 | Versión: 2025.11 recién lanzado