Our Customers
Contact Us Email: support@barcodelib.com
Home > .NET Barcode Reader SDK for .NET, C#, ASP.NET, VB.NET Developers, Free to Download Trial Package
Download Barcode Reader for .NET Trial

How to read GS1 barcodes data from image files using C#?

Barcode Reader for C#.NET is a mature and the best .NET / C# barcode image recognition library in the market.




How to read GS1 data from images in C# ASP.NET, Windows applications?

In February 2005, the GS1 system was officially launched as the successor to the organisations previously known as EAN International (European Article Numbering Association) and UCC (the Uniform Code Council, Inc)

The GS1 system provides for the use of unambiguous identification keys (Application Identifier) to identify goods, services, assets, locations, etc. worldwide. These keys can be represented in data carriers, such as barcodes or EPC/RFID tags, to enable automatic data capture.

The GS1 data message is a group of GS1 system element strings. An element string is the combination of a GS1 Application Identifier (AI) and its data field.

Here is a standard GS1 data element string, "(01)99012345678900(400)PO20240516-123(10)ABC123(11)240516".

There are totally four element strings, earch element string is including an AI code (Application Identifier), and its data field.

  • 01 GTIN (identification of a trade item) fixed 14 digits
  • 400 Customer's purchase order number, variable length from 1 to 30 alphanumeric chars
  • 10 Batch or lot number: variable length from 1 to 20 alphanumeric chars
  • 11 Production date. fixed 6 digits. The current example GS1 data production date is May 16, 2024.
    • Year: the tens and units of the year (e.g., 2024 = 24), which is mandatory.
    • Month: the number of the month (e.g., January = 01), which is mandatory.
    • Day: the number of the day of the relevant month (e.g., second day = 02); if it is not necessary to specify the day, the field must be filled with two zeroes.


Below are the 3 barcode symbology images (QR Code, Data Matrix, and GS1-128), which have encoded the above GS1 data message using BarcodeLib C# barcode generator library



GS1 QR Code





GS1 Data Matrix





GS1-128



Using Barcode Reader for C# library, you can easily read and decode the GS1 data message with GS1 specified data element. Here is the sample C# code to read the above GS1 data matrix image, and parse the scanned GS1 data with list of AI codes and AI data fields.
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
            string inputFilePath = "C://Projects//Demo-Files//datamatrix-mode-gs1-sample-data.png";

            BarCode[] datas = BarcodeReader.BarcodeReader.ReadBarcode(inputFilePath, BarcodeReader.BarcodeReader.DATAMATRIX);

            Trace.WriteLine("Total Data Matrix 2d barcodes found: " + datas.Length);

            foreach (BarCode barcodeData in datas)
            {
                //  Check whether the barcode is GS1 compatible
                //  This is only for QR Code, Data Matrix, and Code 128
                if (barcodeData.IsGS1Compitable)
                {
                    String dataInString = barcodeData.Data;
                    String dataEncoded = barcodeData.GetMessage();
                    Trace.WriteLine("Data string: " + dataInString);
                    Trace.WriteLine("GS1 data message: " + dataEncoded);

                    String[] vals = dataEncoded.Split(new char[] { '(', ')' }, StringSplitOptions.RemoveEmptyEntries);
                    for (int i = 0; i < vals.Length; i += 2)
                    {
                        Trace.WriteLine("AI:" +  vals[i] + "; Data field: " + vals[i + 1]);
                    }
                }
            }


Read GS1 data from the GS1 Data Matrix sample barcode image






















Also provides .NET Barcode Reader, ASP.NET Barcode Reader, C# Barcode Reader, VB.NET Barcode Reader, .NET QR Code Reader, ASP.NET QR Code Reader, C# QR Code Reader, VB.NET QR Code Reader, .NET Data Matrix Reader, .NET Code 128 Reader, Java Barcode SDK, .NET Barcode SDK, ASP.NET Barcode SDK, Visual C# Barcoding, Visual Basic .NET Barcoding.