C# EAN-13 Reader Introduction
C# EAN-13 Reader SDK is a high performance C# linear and 2d barcode recognition SDK for Microsoft Visual Studio C#.NET platform.
Scan and read EAN-13 barcodes from image files is one of the barcode decoding functions in .NET Barcode Reader component. To help .net developers easiy integrate barcode reader control into your .net projects, we provide detailed online tutorial for
C#.NET Barcode Reader component supports scanning and reading 20+ linear, 2d barcodes, including
- Read Code39 in C# | Read QR Code in C# | Read Code128 in C# | Read Data Matrix in C#
- Read UPC-A in C# | Read Codabar in C# | Read Code93 in C# | Read Interleaved 2 of 5 in C#
You may also be interested in:
- Java Barcode Reader | Java Barcode Generator | .NET Barcode Generator | C# Barcode Generator
- ASP.NET Barcode Generator | VB.NET Barcode Generator
Install C#.NET Barcode Reader Control to Your C# project
- Copy OnBarcode.Barcode.BarcodeScanner.dll to your C#.NET project folder (do not copy dll file to your project bin folder).
- Add OnBarcode.BarcodeReader.dll to your C# project reference.
Quick to Scan, Read EAN-13 barcode from images in C#
Using OnBarcode C# Barcode Reader library, you can quickly extract EAN-13 digits and full metadata information from an image file in C#.
- Invokes the static
Scanmethod of theBarcodeScannerclass to perform decoding of an EAN-13 barcode image. Returns an array of text strings representing the decoded EAN-13 barcode digits. - Calls the advanced
ScanInDetailsmethod to retrieve comprehensive EAN-13 metadata from the EAN-13 barcode image. View details about BarcodeDetail for EAN-13 barcode.
string[] datas = BarcodeScanner.Scan("barcode-ean13.png", BarcodeType.EAN13); BarcodeDetail[] datasInDetail = BarcodeScanner.ScanInDetails( "barcode-ean13.png", BarcodeType.EAN13);
Read EAN-13 barcode from image objects in C#
You can also reads EAN-13 barcodes from the entire content of the barcode image file stored a byte array or
Stream object for in-memory processing in C#.
byte[] dataBytes = File.ReadAllBytes("sample-barcode.png"); Stream barcodeInStream = new MemoryStream(dataBytes); string[] datas = BarcodeScanner.Scan(barcodeInStream, BarcodeType.EAN13); BarcodeDetail[] datasInDetail = BarcodeScanner.ScanInDetails( barcodeInStream, BarcodeType.EAN13);
Recognize, read EAN-13 with add-on symbol from image file in C#
The C# Barcode Scanner SDK will automatically scan, and extract the EAN-13 barcodes with 2-digit or 5-digit add-on symbol. The 2-digit or 5-digit data will
be appended to the main EAN 13 digits.
Here you can find the complete extracted EAN13 data is
string[] datas = BarcodeScanner.Scan("barcode-ean13-5-digit.png", BarcodeType.EAN13);
Here you can find the complete extracted EAN13 data is
123456789012812345. The last 5 digits are add-on data.
Scan EAN-8 barcodes using C#
You can also read the EAN-8 barcodes using C# EAN barcode generator library.
- Use parameter
BarcodeType.EAN8to scan and detect all EAN-8 (with or without addon symbol) data from image file
string[] datas = BarcodeScanner.Scan("barcode-ean8-sample.png", BarcodeType.EAN8);
How to verify scanned EAN-13 code?
EAN-13 barcode includes one mandatory checksum digit. When a EAN-13 barcode is encoded, the barcode encoder will automatically calculate the EAN-13 checksum digit based on the input first 12 data digits, and append the check digit to the end of the EAN-13 barcode.
Using OnBarcode C# EAN/UPC Barcode Reader library, you will extract the EAN13 first 12 data digits and the last checksum digit. And the C# barcode library will apply the scanned check character to verify the scanned EAN-13 data digits. If the verification is failed, the barcode scanner sdk will not return the scanned result.
Using OnBarcode C# EAN/UPC Barcode Reader library, you will extract the EAN13 first 12 data digits and the last checksum digit. And the C# barcode library will apply the scanned check character to verify the scanned EAN-13 data digits. If the verification is failed, the barcode scanner sdk will not return the scanned result.
Enhance EAN-13 reading performance
OnBarcode C# Barcode Reader library supports multiple methods to improve the barcode recognition performance. You can easily increase the imperfect
EAN13 barcode image recognition ratio.
Here is a simple example. The original EAN13 image is blur (bars in the image are contaminated by surrounding spaces), and it cannot be scanned by the barcode reader library. Here we have applied the image processing method
After the image process function
Here is a simple example. The original EAN13 image is blur (bars in the image are contaminated by surrounding spaces), and it cannot be scanned by the barcode reader library. Here we have applied the image processing method
Dilate to improve the barcode image quality. And the barcode scanner library can scan and recognize the image processed barcode image.
String filePath = Path.Combine(rootDir, "Failed.png"); // Scan original image { BarcodeDetail[] result = BarcodeScanner.Scan(filePath, new ScanOptions(BarcodeType.EAN13)); if (result != null && result.Length > 0) Console.WriteLine("Message: " + result[0].GetMessage()); else Console.WriteLine("[ERROR]: No Barcode Found !!!"); } // Scan fixed image { // Fix original image by using Dilate. String fixFilePath = Path.Combine(rootDir, "Fix_Dilate.png"); ImageProcessor processor = ImageProcessor.FromFile(filePath); processor.Dilate(); // Save the fixed image processor.SaveToFileAsPNG(fixFilePath); BarcodeDetail[] result = BarcodeScanner.Scan(fixFilePath, new ScanOptions(BarcodeType.EAN13)); if (result != null && result.Length > 0) Console.WriteLine("Message: " + result[0].GetMessage()); else Console.WriteLine("[ERROR]: No Barcode Found !!!"); }
| Source image | Image Process Dilate applied |
|
|
After the image process function
Dilate applied, the new EAN13 barcode image can be scanned and recognized by barcode library successfully.
View more datails about barcode image processing
Common Asked Questions
How can I read EAN-13 barcode images in C# project?
You can scan and read a EAN-13 barcode image file in C# using OnBarcode C# Barcode Reader library, which provides simple .NET API
for scanning EAN-13 barcode images and customizing scanning options to enhance reading performance.
What is the EAN-13 barcode?
EAN-13 is a 13-digit linear barcode, which contains 12-digit GS1 data message and 1 check digit. EAN is short for European Article Number,
and now it is renamed as GTIN (Global Trade Item Number). EAN 13 code will be used to uniquely identify retail products worldwide.
In C# class, you can use OnBarcode C# Barcode Reader library to scan and read EAN-13 barcode text from image files in C# ASP.NET, MVC, Windows applications.
In C# class, you can use OnBarcode C# Barcode Reader library to scan and read EAN-13 barcode text from image files in C# ASP.NET, MVC, Windows applications.
How to check if EAN-13 is valid in C# application?
In the EAN-13 barcode, the first 12-digit of the number identify the item ID, and the final digit is a "check digit".
Using C# Barcode Reader Library, the scanned and decoded EAN-13 data will be verified by the last check digit.
How to read EAN-13 barcode?
You can use a barcode scanner device or barcode reader software to read and extract EAN-13 numbers from images.
OnBarcode C# Barcode Scanner library enables ASP.NET Core, MVC, WinForms, WPF apps to scan and read EAN-13, UPC-A, QR Code and other 2d, linear barcode text from image files.
How to scan EAN code?
EAN barcode usually includes EAN-13, EAN-8 and 2-digit or 5-digit addon. You can use barcode software or scanners to capture, read and recognize EAN barcodes from images.
C# Barcode Reader library supports both EAN-13 and EAN-8 (with or without addon) reading in C# ASP.NET Core, MVC web and Windows apps.
What file formats can C# Barcode Reader SDK scan EAN-13 barcodes from?
C# Barcode Reader SDK allows you to load and scan the EAN-13 barcodes from various raster image formats, including
bitmap, png, jpeg, gif, multi-page tiff image file, making it versatile for various enterprise application needs.
Using 3rd party free component, you can also read EAN-13 barcodes from
Adobe PDF, Microsoft Office Word, Excel and PowerPoint documents in C# ASP.NET, Windows applications.
Is it possible to customize EAN-13 barcode scan options using Barcode Reader component?
Yes. OnBarcode C# EAN-13 Barcode Reader library provides various barcode scanning options to reduce barcode recognition time,
improve barcode reading performance in C# applications.
Does C# Barcode Scanner library support EAN-13 with add-on digits scanning?
Yes. C# Barcode Reader library supports EAN-13 with 2-digit or 5-digit add-on barcodes reading. The scanned add-on digits code will be
appended to the EAN-13 data code (13 digits). For example, in the EAN-13 demo image below the last 5 digits "12345" is the EAN-13 add-on code.
Besides EAN-13, does C# Barcode Scanner library supports EAN-8, EAN-14, EAN-128 barcodes scanning also?
Yes. Using C# Barcode Reader library, you can quickly scan and detect all EAN-13, EAN-8, EAN-14, EAN-128 (GS1-128) barcodes from
image files in C# ASP.NET Core, MVC, WinForms, WPF web and desktop applications.
What are the benefits of using OnBarcode C# EAN-13 Barcode reader in C# application?
OnBarcode C# Barcode Scanner SDK provides easy to use .NET API for scanning and reading EAN-13 and other 2d, linear barcodes from image files,
allowing for customization to speed up reading speed, reducing reading errors, enhance barcode reading performance in your
C# web and Windows applications. It simplifies the complex barcode reading process with detailed step by step C# code examples.