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
- Introduction
- Why Read Multiple 1D Barcodes in One Image?
- Quick Start Example
- Prerequisites
- Step-by-Step Guide
- Tips for Reliable Multi-Barcode Recognition
- Supported 1D Symbologies
- Troubleshooting & Common Issues
- FAQs
- Best Practices
- 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
- Install Aspose.BarCode for .NET.
- Prepare an input image (e.g., a product label or inventory sheet with multiple barcode types).
- Create a BarCodeReader instance:
- Process recognition results: For each
BarCodeResult
, access type, value, region, orientation, and confidence as needed. - 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
Tip | Do | Don’t |
---|---|---|
Input Types | Use only necessary DecodeTypes | Use AllSupportedTypes |
Image Quality | Use 300+ DPI images for scanning | Use low-res or blurry |
Exception Handling | Catch & handle all exceptions | Ignore 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 .