How to Read Multiple 1D Barcode Types from a Single Image in .NET

How to Read Multiple 1D Barcode Types from a Single Image in .NET

Retail, warehouse, and logistics operations often require scanning several types of barcodes in a single batch—such as shipping labels containing UPC, EAN, and Code 128. Efficient multi-barcode recognition saves time and reduces errors in inventory and checkout workflows.

Quick Start Example

using Aspose.BarCode.BarCodeRecognition;
using System;

class Program
{
  static void Main()
  {
    string imagePath = "multiple_barcodes.png"; // Replace with your file
    using (BarCodeReader reader = new BarCodeReader(imagePath, DecodeType.UPCA, DecodeType.EAN13, DecodeType.Code39, DecodeType.Code128))
    {
      foreach (BarCodeResult result in reader.ReadBarCodes())
        Console.WriteLine($"Type: {result.CodeTypeName}, Value: {result.CodeText}");
    }
  }
} 

Table of Contents

  1. Introduction
  2. Why Read Multiple 1D Barcodes in One Image?
  3. Quick Start Example
  4. Prerequisites
  5. Step-by-Step Guide
  6. Tips for Reliable Multi-Barcode Recognition
  7. Supported 1D Symbologies
  8. Troubleshooting & Common Issues
  9. FAQs
  10. Best Practices
  11. Conclusion

Introduction

This article demonstrates how to use Aspose.BarCode for .NET to scan and extract multiple 1D barcodes from a single image. The guide covers practical scenarios in retail, logistics, and inventory management where batch barcode recognition boosts efficiency.


Prerequisites

  • Visual Studio 2019 or later
  • .NET 6.0+ or .NET Framework 4.6.2+
  • Aspose.BarCode for .NET (NuGet)
  • A sample image with multiple 1D barcodes
PM> Install-Package Aspose.BarCode 

Step-by-Step Guide

  1. Install Aspose.BarCode for .NET.
  2. Prepare an input image (e.g., a product label or inventory sheet with multiple barcode types).
  3. Create a BarCodeReader instance:
  4. Process recognition results: For each BarCodeResult, access type, value, region, orientation, and confidence as needed.
  5. Handle exceptions for invalid images or unsupported formats.

Tips for Reliable Multi-Barcode Recognition

  • Use clear, high-resolution images (minimize glare/shadows).
  • Specify only required DecodeTypes for speed and accuracy.
  • If false positives, try restricting to 1D barcode types only.
  • For dense layouts, crop or specify regions of interest with Rectangle objects.

Supported 1D Symbologies

Aspose.BarCode for .NET can recognize all major 1D barcode types, including:

  • UPC-A, UPC-E
  • EAN-8, EAN-13, JAN
  • Code 39, Code 128, Code 93
  • Interleaved 2 of 5, Standard 2 of 5, MSI, ITF-14
  • Codabar, Plessey, POSTNET, PLANET, and more

Troubleshooting & Common Issues

  • Barcode not detected?

    • Try increasing image quality or adjusting the barcode region.
  • Wrong type returned?

    • Specify the exact DecodeTypes required, not AllSupportedTypes.
  • Performance slow with many types?

    • Restrict recognition to a specific set of 1D barcode types.

FAQs

Q: Can I read both 1D and 2D barcodes together? A: Yes, add desired 2D types to the DecodeType list as needed.

Q: Can I scan from streams or bitmaps? A: Yes, BarCodeReader supports streams, bitmaps, and file paths.


Best Practices

TipDoDon’t
Input TypesUse only necessary DecodeTypesUse AllSupportedTypes
Image QualityUse 300+ DPI images for scanningUse low-res or blurry
Exception HandlingCatch & handle all exceptionsIgnore errors

Conclusion

Multi-barcode recognition is essential for modern inventory, shipping, and retail systems. Aspose.BarCode for .NET makes it easy to scan and decode multiple 1D barcodes from a single image, boosting speed and reducing manual work. For advanced features, see the Aspose.BarCode API Reference .

 English