COMPARE TO OTHER COMPONENTS

A Comparison between IronBarcode and Aspose.Barcode

Published April 27, 2022
Share:

Introduction

A barcode is a machine-readable visual representation of data. Barcodes were first used to express data by changing the lengths and spacings of parallel lines. These linear or one-dimensional (1D) barcodes may be scanned using special optical scanners known as barcode readers, of which there are various types. Later, two-dimensional (2D) variations using rectangles, dots, hexagons, and other patterns were developed and dubbed matrix codes, despite the fact that they do not use bars. Purpose-built 2D optical scanners, which come in a variety of configurations, can read 2D barcodes. A digital camera attached to a microcomputer can take a photographic image of a barcode while running software that scans 2D barcodes — it deconstructs and then decodes the barcode by analyzing the image. Using specialized application software, a mobile device with an inbuilt camera, such as a smartphone, can act as the latter sort of 2D barcode scanner.

In this article, we are going to compare two popular barcode libraries

  • Aspose.Barcode
  • IronBarcode

Both libraries can be used for the generation and recognition of barcodes. There is support for all .NET frameworks, and barcode images can be easily saved.

Features

Aspose.Barcode

Aspose.BarCode for .NET is a sophisticated tool that allows you to create and recognize 1D and 2D barcodes from a variety of picture sources at any angle. Barcode creation and scanning capability may be simply added to .NET applications by developers. It also allows for the exporting of created barcodes to multiple high-quality picture formats and APIs for creating new barcodes and recognizing old barcodes from a variety of angles. There is support for over 60 different 1D, 2D, and postal barcode symbologies.

Aspose.BarCode for .NET allows you to change the background color, bar color, rotation angle, x-dimension, image quality, resolution, captions, size, and more for the created barcodes. The API also supports a variety of identification and imaging features, as well as a variety of symbologies.

  • Aspose allows us to generate and recognize 40+ barcode symbologies with just a few lines of code.
  • Read barcodes at any angle.
  • Easily print barcode labels to physical or virtual printers.
  • Checksum and barcode supplement data are supported.
  • Code128 encoding has been improved.
  • Set the image area where the barcode will be scanned.
  • Create images that are dependent on the device's resolution.
  • Recognition formats and images: JPEG, TIFF, PNG, BMP, GIF, EXIF Save BarCode Labels as Images: EMF, SVG Platform Independence, 2D, and postal barcodes.

IronBarcode

IronBarcode for .NET allows programmers to read and write barcodes and QR codes from within .NET apps and websites. IronBarcode simply requires a single line of code to read or write barcodes. Most barcode and QR standards can be read and written using the .NET barcode library. Code 39/93/128, UPC A/E, EAN 8/13, ITF, RSS 14 / Expanded, Databar, CodaBar, Aztec, Data Matrix, MaxiCode, PDF417, MSI, Plessey, USPS, and QR are some of the most common. Type, text, binary data, page, and picture files are all included in the barcode result data. The IronBarcode's API features are as follows:

  • IronBarcode reads and writes most barcode types and QR standards, including UPC A/E, EAN 8/13, Code 39/93/128, ITF, MSI, RSS 14/Expanded, Databar, CodaB
  • ar, QR, Styled QR, Data Matrix, MaxiCode, PDF417, Plessey, and Aztec. The barcode data, type, page, text, and barcode picture provided by the results are perfect for archiving or indexing systems.
  • Image pre-processing improves reading speed and accuracy — IronBarcode automatically pre-processes barcode pictures to increase reading speed and accuracy. It can read scans or live video frames, as well as correct rotation, noise, distortion, and skewing. Batch-processing server applications can take advantage of several cores and threads. Find one or more barcodes in single and multi-page documents automatically. Without needing to use complicated APIs, you can search for specific barcode kinds or document locations.
  • Designed for use with .NET projects — get up and running in minutes with just a few lines of code. Built for the .NET Framework as a single DLL with no dependencies; supports 32 and 64-bit, and may be used in any .NET and dot net core language. Supports mobile and desktop devices in web, cloud, desktop, and console applications.
  • Create barcodes and QR codes for a variety of document formats — save and print to a file or stream in a variety of file and stream formats, including PDF, JPG, TIFF, GIF, BMP, PNG, and HTML. Color, quality, rotation, size, and text can all be changed.

1. Creating a New Project

Open Visual studio, go to file menu, and select "new project", then select console application/Windows Forms/WPF Application. Barcodes can also be used on all types of applications. You can also use apps such as Webform/MVC/MVC Core.

Enter the project name and select the file path in the appropriate text box. Then, click the create button and select the required dot net framework. The project will now generate the structure for the selected application, and, if you have selected the console application, it will open the program.cs file where you can enter the code and build/run the application.

2. Install the Barcode Library

2.1 Using IronBarcode

The IronBarcode library can be downloaded and installed in four ways.

These are:

  • Using Visual Studio
  • Using the Visual Studio Command-Line.
  • Direct download from the NuGet website.
  • Direct download from the IronBarcode website.

2.1.1 Using Visual Studio

The Visual Studio software provides the NuGet Package manager option to install the package directly to the solution. The below screenshot shows how to open the NuGet Package Manager.

It provides a search box to show the list of the packages from the NuGet website. In the package manager, we need to search for the keyword "Barcode", as in the screenshot below:

From the above image, we will get the list of the related search results. We need to select the required option to install the package to the solution.

2.1.2 Using the Visual Studio Command-Line

In Visual Studio, go to Tools-> NuGet Package Manager -> Package Manager Console

Enter the following line in the console tab:

Install-Package BarCode

The package will now download/install in the current project and be ready to use.

2.1.3 Direct Download from the NuGet Website

The third way is to download the package directly from the website.

  • Navigate to the Link
  • Select the download package option from the menu on the right-hand side.
  • Double-click the downloaded package. It will be installed automatically.
  • Next, reload the solution and start using it in the project.

2.1.4 Direct Download from the IronBarcode Website

Click the link "https://ironsoftware.com/csharp/barcode/packages/IronBarCode.zip" here to download the latest package directly from the website. Once downloaded, follow the steps below to add the package to the project.

  • Right-click the project from the solution window.
  • Next, select the option reference and then browse the location of the downloaded reference.
  • Next, click OK to add the reference.

2.2 Using Aspose.BarCode

The Aspose.BarCode library can be downloaded and installed in four ways.

These are:

  • Using Visual Studio
  • Using the Visual Studio Command-Line.
  • Direct download from the NuGet website.
  • Direct download from the IronBarcode website.

2.2.1 Using Visual Studio

This method is similar to that described above for IronBarcode. The only thing we need to change is the search criteria, as in the image below.

Select the first option which will download the Aspose.Barcode library.

2.2.2 Using the Visual Studio Command-Line

In Visual Studio, go to Tools-> NuGet Package Manager -> Package Manager Console

Enter the following line in the package manager console tab.

Install-Package Aspose.BarCode

The package will now download/install in the current project and be ready to use.

2.2.3 Direct Download from the NuGet Website

The third way is to download the package directly from the website.

Just click here and it will redirect to the NuGet website where you can download the package.

2.2.4 Direct Download from the Aspose Website

Click the link here and it will redirect to the list of package versions where we can choose the required version to download. Once downloaded, follow the steps below to add the package to the project.

  • Right-click the project from the solution window.
  • Next, select option reference and then browse the location of the downloaded reference.
  • Next, click OK to add the reference.

3. Barcode Generation

Barcode generation can be done easily with IronBarcode and Aspose.Barcode. Let us take a look at this using an example.

3.1 Using IronBarcode

IronBarcode can be used to create a barcode label that can be saved in a variety of image formats. We can also pass the type of barcode that we need to generate. Below is the following snippet for the barcode generation:

var MyBarCode = BarcodeWriter.CreateBarcode("123456",                    
        BarcodeEncoding.Code128) 
MyBarCode.AddAnnotationTextBelowBarcode("123456");
MyBarCode.SaveAsImage("MyBarCode.jpeg");
var MyBarCode = BarcodeWriter.CreateBarcode("123456",                    
        BarcodeEncoding.Code128) 
MyBarCode.AddAnnotationTextBelowBarcode("123456");
MyBarCode.SaveAsImage("MyBarCode.jpeg");
Dim MyBarCode = BarcodeWriter.CreateBarcode("123456", BarcodeEncoding.Code128) MyBarCode.AddAnnotationTextBelowBarcode("123456")
MyBarCode.SaveAsImage("MyBarCode.jpeg")
VB   C#

Barcodewriter.createbarcode is a static class that is available in the IronBarcode namespace. We need to pass two parameters in the create barcode function that are string values in order to convert and barcode types. We can also specify bar height and width using the CreateBarcode function, but this is optional and is not required to generate barcodes.

After sending the parameter it will return the barcode object, which in turn will return different barcode properties with which we are able to add properties like the above sample code. AddAnnotationTextBelowBarcode is one of the properties that allows us to add the text below or above the barcode labels. If we need, we can also hide barcode text. In the above code, the ipeg generator helps barcodes save to the jpeg image format.

As well as image formats, we can also export the barcodes in HTML format. We have different types of images generated to save in different image formats. Also, we are able to read more than one barcode from a given barcode image.

 var QRWithLogo = QRCodeWriter.CreateQrCodeWithLogo("Hello World",                       "logo.png",500);
QRWithLogo.ChangeBarCodeColor(System.Drawing.Color.DarkGreen);
QRWithLogo.SaveAsJpeg("Logoqr.jpeg");
 var QRWithLogo = QRCodeWriter.CreateQrCodeWithLogo("Hello World",                       "logo.png",500);
QRWithLogo.ChangeBarCodeColor(System.Drawing.Color.DarkGreen);
QRWithLogo.SaveAsJpeg("Logoqr.jpeg");
Dim QRWithLogo = QRCodeWriter.CreateQrCodeWithLogo("Hello World", "logo.png",500)
QRWithLogo.ChangeBarCodeColor(System.Drawing.Color.DarkGreen)
QRWithLogo.SaveAsJpeg("Logoqr.jpeg")
VB   C#

The above example shows that we can generate a barcode with the image inside the QRcode. CreateQrCodeWithLogo is a function that allows us to perform this task. We are also using the function ChangeBarCodeColor which will help us to change the color of the barcode/QR code. These functions in IronBarcode can assist in creating custom barcodes for business purposes.

3.2 Using Aspose.Barcode

Aspose.BarCode can be used for barcode generation. We can generate different barcode types. The following code snippet can be used to create a barcode:

BarcodeGenerator generator = new BarcodeGenerator(EncodeTypes.Code128,                                  
                 "123456");
     generator.Save("output.jpg", BarCodeImageFormat.Jpeg);
BarcodeGenerator generator = new BarcodeGenerator(EncodeTypes.Code128,                                  
                 "123456");
     generator.Save("output.jpg", BarCodeImageFormat.Jpeg);
Dim generator As New BarcodeGenerator(EncodeTypes.Code128, "123456")
	 generator.Save("output.jpg", BarCodeImageFormat.Jpeg)
VB   C#

The above code shows that BarcodeGenerator is a class with which we can generate a barcode by creating an object. We need to pass two parameters; one is the barcode type, and the other is the barcode string which we need to create a barcode. It will be converted into a BarcodeGenerator object.

The Barcode generation object provides a function called save which allows us to save the created barcode into an image format to jpeg in the given code snippet. Not only in jpeg format but we are also able to save in different barcode properties like Jpeg tiff etc.,

Bar height and width can be resized using a separate function. The Barcode Generator object has a value to set this: "Parameters.Barcode.XDimension.Millimeters", which allows us to specify the line height and width.

Result:

The above image is the performance comparison of these libraries. Time is calculated in milliseconds.

4 Recognize Barcodes

IronBarcode and Aspose.Barcodes allow us to recognize barcodes from different image formats and the types to which they belong. Let's take a look in detail.

4.1 Using IronBarcode

IronBarcode helps to read barcodes from different image formats and can be defined in three ways: as string, as stream, or as an image such as jpeg, tiff, Bitmap, etc. The following example is for reading a barcode from an image using the string method.

BarcodeResult QRResult = BarcodeReader.QuicklyReadOneBarcode                   
            ("MyBarCode.jpg");
    if (QRResult != null)
    {               
           Console.WriteLine(QRResult.Value);                
           Console.WriteLine(QRResult.BarcodeType);            
    }
BarcodeResult QRResult = BarcodeReader.QuicklyReadOneBarcode                   
            ("MyBarCode.jpg");
    if (QRResult != null)
    {               
           Console.WriteLine(QRResult.Value);                
           Console.WriteLine(QRResult.BarcodeType);            
    }
Dim QRResult As BarcodeResult = BarcodeReader.QuicklyReadOneBarcode("MyBarCode.jpg")
	If QRResult IsNot Nothing Then
		   Console.WriteLine(QRResult.Value)
		   Console.WriteLine(QRResult.BarcodeType)
	End If
VB   C#

The above describes that we are using a class BarcodeReader which has different properties. One of the properties is QuicklyReadOneBarcode, which helps us to read the barcode from the image formats. It also helps us to convert them into BarcodeResult objects. The object enables us to get the barcode value and the type of barcode we are reading from the image.

The BarcodeResult has the following values:

  • Barcode type
  • Value
  • Text
  • Binary value

The type of the barcode in the supplied input image is returned by BarcodeType, which is an enum data type. IronBarcode supports a total of twenty-two barcode formats. The type of barcode that is applied to the provided input image will be returned.

The object type values available in the BarcodeResult are also value and text. String data types include value and text. These return the barcode's string value. QuicklyReadOneBarcode reads a QR code or barcode and converts the string value of the image into value/text. The binary value is of the byte data type and returns the image's byte. The quick-answer code is shown below and may be pasted into any net windows forms or net standard application.

4.2 Using Aspose.Barcode

The source for barcode recognition in BarCode for .NET can be defined in three ways: as an image file, a stream, or a bitmap. BMP, PNG, JPEG, GIF, and TIFF are the five picture formats that can be used to read a barcode from files. The implementation details for three different modes are also supplied. Below is the following example for using the string method.

using (BarCodeReader reader = new BarCodeReader(@"MyBarCode.jpg"))
  {
         foreach (BarCodeResult result in reader.ReadBarCodes())
          {
             Console.WriteLine("Type: " + result.CodeType);
             Console.WriteLine("CodeText: " + result.CodeText);
         }
   }
using (BarCodeReader reader = new BarCodeReader(@"MyBarCode.jpg"))
  {
         foreach (BarCodeResult result in reader.ReadBarCodes())
          {
             Console.WriteLine("Type: " + result.CodeType);
             Console.WriteLine("CodeText: " + result.CodeText);
         }
   }
Using reader As New BarCodeReader("MyBarCode.jpg")
		 For Each result As BarCodeResult In reader.ReadBarCodes()
			 Console.WriteLine("Type: " & result.CodeType)
			 Console.WriteLine("CodeText: " & result.CodeText)
		 Next result
End Using
VB   C#

The above code shows that we are reading the barcode from the jpeg format. BarcodeReader is a class that helps us read the barcode image using the image path as a parameter. Once we have passed the image path, it will convert the image into a Barcode Reader object. Then, we can use the object to get the value from the image.

BarcodeReader objects have a function called ReadBarCodes(). This will help us to get all the available codes in the images. Using the "for loop" we can get the images one-by-one and hold them in the BarCodeResult object. With the object, we can read the value and type of the barcode. This enables us to read multiple barcodes at once.

5. Conclusion

IronBarcode is one of the most powerful libraries to help us to generate and recognize barcodes. It is also one of the fastest libraries for generating and recognizing barcodes. The library is supported by various operating systems. It supports a wide variety of barcode formats and is easy to create. We can change color, line height, width, barcode text, etc. The licensing details can be found here.

Aspose.BarCode is also a powerful library for generating and reading barcodes with different image formats. We can use various image formats to read and create. Aspose also provides an option for us to change the barcode's appearance in terms of height, width, barcode text, etc. We can find the licensing details here.

IronBarcode does enjoy several advantages over Aspose.Barcode. When we compare the processing times for the recognition and generation of barcodes, IronBarcode has the advantage of being faster than Aspose.Barcode. IronBarcode also has various properties which allow not only for the reading of barcodes from different image formats but also for the reading of barcodes from PDF documents. We can also add images inside barcodes and QR codes, a feature that is not available in any other library.

< PREVIOUS
A Comparison between IronBarcode and ZXing.NET
NEXT >
A Comparison between IronBarcode and Spire Barcode

Ready to get started? Version: 2024.10 just released

Free NuGet Download Total downloads: 1,246,703 View Licenses >