Set Max Parallel Threads

Processing large batches of documents or images sequentially can be time-consuming, creating bottlenecks in high-volume applications. Using parallel threads allows the application to process multiple images simultaneously, significantly reducing overall execution time. In this code example, we will demonstrate how to configure IronBarcode to use multi-threading for faster batch barcode reading.

5-step guide for using parallel threads to read barcode

  • using IronBarCode;
  • using System.Threading.Tasks;
  • List<string> imagePaths = new List<string>() { "sample_a.png", "sample_b.png" };
  • BarcodeReaderOptions options = new BarcodeReaderOptions(){ Multithreaded = true, MaxParallelThreads = 4 };
  • BarcodeResults results = BarcodeReader.Read(imagePaths, options);

Code Explanation

First, the IronBarcode library and the threading namespace are imported, and a List<string> containing the file paths of the images to be processed is defined. In the example above, "sample_a.png" and "sample_b.png" are prepared for scanning.

Next, a BarcodeReaderOptions object is instantiated to configure the scanning behavior. Multithreaded Additionally, the ParallelProcessing property is set to true to enable parallel processing. Multithreaded The MaxDegreeOfParallelism property is also set to 4, instructing the reader to use up to 4 simultaneous threads while balancing performance with system resource usage. MaxParallelThreads MaxParallelThreads Read BarcodeReader.Read

Finally, ReadBarcodes is called, passing both the list of image paths and the configured options to retrieve the BarcodeResults.

Learn to set max parallel threads with IronBarcode

Ready to Get Started?
Nuget Downloads 2,206,960 | Version: 2026.5 just released
Still Scrolling Icon

Still Scrolling?

Want proof fast? PM > Install-Package BarCode
run a sample watch your string become a barcode.