Saltar al pie de página
COMPARAR CON OTROS COMPONENTES

Biblioteca QR Code ZXing.org e IronBarcode: Una Comparación Exhaustiva

If you already have an electronic image of the barcode in tech phone/admin phone and want to decipher it as English text data, a barcode scanner might not be the best tool. Additionally, barcode scanners are limited to reading only 1-D barcodes which have restricted storage capacity, domain status, supported formats and can only be used with the Windows RT Class library. Nowadays, 2-D barcodes (also called QR codes) are more common and can store significantly more information like updated date.

A barcode scanning application can run on Windows, MacOS, or Linux without relying on any third-party tools or APIs since it is supported by .NET.

ZXing.org QR Code Library and IronBarcode: A Comprehensive Comparison: Figure 2 - Web Application

Creating and scanning barcodes has become essential for many businesses to avoid spam. Two popular tools for creating barcodes are the open source ZXing project decode and IronBarcode. In this article, we'll explore the features and benefits of each of these tools and compare them.

ZXing Decoder

ZXing is a popular open-source library for generating and decoding 1D and 2D barcodes.

It also supports multiple programming languages, including Java, C++, and .NET.

The ZXing Decoder Online is a web-based tool that enables users to scan and decode barcode and QR code images. Additionally, users can create QR codes for any information, which is usually in the form of a URL or text that they want to encode.

To use the ZXing online decoder, follow these steps:

  1. Visit the ZXing Decoder Online website.

    ZXing.org QR Code Library and IronBarcode: A Comprehensive Comparison: Figure 2 - ZXing Web developed by Google

  2. Click on the "Choose File" button to select a QR Code image file.
  3. Once you have selected the image, click the "Submit" button.

    ZXing.org QR Code Library and IronBarcode: A Comprehensive Comparison: Figure 3 - ZXing Decode

  4. If a recognizable code is found, the tool will decode the QR Code and display the resulting information.

The library is easy to use and can be integrated into web applications, mobile apps, and desktop applications.

ZXing has been widely adopted and has a large community of developers contributing to its development and providing support.

The library collects device information such as the device model and OS version, which can be considered a potential security risk.

Additionally, some have raised concerns over the ownership and control of the library, as it is not maintained by an independent organization.

Overall, ZXing is a powerful and versatile library for barcode generation and decoding, with widespread adoption and community support.

To generate a QR code using ZXing, for example, developers only need to write a few lines of code:

using ZXing;
using ZXing.QrCode;

// Create a BarcodeWriter instance to generate QR codes
BarcodeWriter writer = new BarcodeWriter
{
    Format = BarcodeFormat.QR_CODE // Set format to QR_CODE
};

// Generate a QR code with the text "Hello, ZXing!"
Bitmap qrCode = writer.Write("Hello, ZXing!");
using ZXing;
using ZXing.QrCode;

// Create a BarcodeWriter instance to generate QR codes
BarcodeWriter writer = new BarcodeWriter
{
    Format = BarcodeFormat.QR_CODE // Set format to QR_CODE
};

// Generate a QR code with the text "Hello, ZXing!"
Bitmap qrCode = writer.Write("Hello, ZXing!");
Imports ZXing
Imports ZXing.QrCode

' Create a BarcodeWriter instance to generate QR codes
Private writer As New BarcodeWriter With {.Format = BarcodeFormat.QR_CODE}

' Generate a QR code with the text "Hello, ZXing!"
Private qrCode As Bitmap = writer.Write("Hello, ZXing!")
$vbLabelText   $csharpLabel

To decode a QR code using the ZXing project, developers can use the following code:

using ZXing;
using ZXing.QrCode;

// Create a BarcodeReader instance for decoding QR codes
BarcodeReader reader = new BarcodeReader();

// Decode the QR code from a bitmap image
Result result = reader.Decode(qrCode);

// Extract the text from the decoded QR code
string text = result.Text;
using ZXing;
using ZXing.QrCode;

// Create a BarcodeReader instance for decoding QR codes
BarcodeReader reader = new BarcodeReader();

// Decode the QR code from a bitmap image
Result result = reader.Decode(qrCode);

// Extract the text from the decoded QR code
string text = result.Text;
Imports ZXing
Imports ZXing.QrCode

' Create a BarcodeReader instance for decoding QR codes
Private reader As New BarcodeReader()

' Decode the QR code from a bitmap image
Private result As Result = reader.Decode(qrCode)

' Extract the text from the decoded QR code
Private text As String = result.Text
$vbLabelText   $csharpLabel

ZXing.org QR Code Library and IronBarcode: A Comprehensive Comparison: Figure 4 - QR Code Generator

ZXing.org QR Code Library and IronBarcode: A Comprehensive Comparison: Figure 5 - QR Code Files Displayed

Introducing IronBarcode

IronBarcode is a powerful barcode generation and scanning library for .NET developers, created by Iron Software.

IronBarcode provides an easy-to-use API that allows developers to generate and scan various barcode types, including QR codes, Data Matrix codes, and UPC-A barcodes.

The IronBarcode library was created by Iron Software as a way to extend the functionality of the ZXing.NET library.

ZXing.org QR Code Library and IronBarcode: A Comprehensive Comparison: Figure 6 - Supported Barcode Formats

It adds new features and functionality, such as the ability to generate 2D barcodes, PDF417 barcodes and the ability to read barcodes directly from image files.

Here's an example of how to generate a QR code using IronBarcode:

using IronBarCode;

// Generate a QR code with the text "Hello, IronBarcode!"
var barcode = BarcodeWriter.CreateBarcode("Hello, IronBarcode!", BarcodeWriterEncoding.QRCode);

// Save the generated QR code as a PNG image
barcode.SaveAsImage("qrcode.png");
using IronBarCode;

// Generate a QR code with the text "Hello, IronBarcode!"
var barcode = BarcodeWriter.CreateBarcode("Hello, IronBarcode!", BarcodeWriterEncoding.QRCode);

// Save the generated QR code as a PNG image
barcode.SaveAsImage("qrcode.png");
Imports IronBarCode

' Generate a QR code with the text "Hello, IronBarcode!"
Private barcode = BarcodeWriter.CreateBarcode("Hello, IronBarcode!", BarcodeWriterEncoding.QRCode)

' Save the generated QR code as a PNG image
barcode.SaveAsImage("qrcode.png")
$vbLabelText   $csharpLabel

ZXing.org QR Code Library and IronBarcode: A Comprehensive Comparison: Figure 7 - QR Code

To scan a barcode using IronBarcode, you can use the following code:

using IronBarCode;

// Read the QR code from the image file "qrcode.png"
var barcode = BarcodeReader.ReadBarcode("qrcode.png", BarcodeEncoding.QRCode);

// Extract the text from the decoded QR code
string text = barcode.Text;
using IronBarCode;

// Read the QR code from the image file "qrcode.png"
var barcode = BarcodeReader.ReadBarcode("qrcode.png", BarcodeEncoding.QRCode);

// Extract the text from the decoded QR code
string text = barcode.Text;
Imports IronBarCode

' Read the QR code from the image file "qrcode.png"
Private barcode = BarcodeReader.ReadBarcode("qrcode.png", BarcodeEncoding.QRCode)

' Extract the text from the decoded QR code
Private text As String = barcode.Text
$vbLabelText   $csharpLabel

ZXing.org QR Code Library and IronBarcode: A Comprehensive Comparison: Figure 8 - Create a Barcode Image in C#

IronBarcode supports a wide range of barcode types, including 2D Barcode, UPC-A, UPC-E, EAN-8, EAN-13, Code39, Code128, PDF417, and many more.

It builds on the strengths of the ZXing.NET library, providing faster, more accurate barcode scanning and generation while also adding new features and functionality.

How to Use IronBarcode

Here are some steps on how to use IronBarcode:

Step 1: Install the IronBarcode Library

To use IronBarcode in your .NET project, you first need to install the IronBarcode library using NuGet. You can do this by running the following command in the NuGet Package Manager Console:

Install-Package BarCode

Step 2: Generate a Barcode

To generate a barcode using IronBarcode, you can use the BarcodeWriter class.

using IronBarCode;

// Generate a QR code with the text "Hello, IronBarcode!"
var barcode = BarcodeWriter.CreateBarcode("Hello, IronBarcode!", BarcodeWriterEncoding.QRCode);

// Save the generated QR code as an image file
barcode.SaveAsImage("qrcode.png");
using IronBarCode;

// Generate a QR code with the text "Hello, IronBarcode!"
var barcode = BarcodeWriter.CreateBarcode("Hello, IronBarcode!", BarcodeWriterEncoding.QRCode);

// Save the generated QR code as an image file
barcode.SaveAsImage("qrcode.png");
Imports IronBarCode

' Generate a QR code with the text "Hello, IronBarcode!"
Private barcode = BarcodeWriter.CreateBarcode("Hello, IronBarcode!", BarcodeWriterEncoding.QRCode)

' Save the generated QR code as an image file
barcode.SaveAsImage("qrcode.png")
$vbLabelText   $csharpLabel

This code creates a QR code with the text "Hello, IronBarcode!" and saves it as an image file named "qrcode.png".

Step 3: Scan a Barcode

To scan a barcode using IronBarcode, you can use the BarcodeReader class.

using IronBarCode;

// Read the QR code from the image file "qrcode.png"
var barcode = BarcodeReader.ReadBarcode("qrcode.png", BarcodeEncoding.QRCode);

// Extract the text from the decoded QR code
string text = barcode.Text;
using IronBarCode;

// Read the QR code from the image file "qrcode.png"
var barcode = BarcodeReader.ReadBarcode("qrcode.png", BarcodeEncoding.QRCode);

// Extract the text from the decoded QR code
string text = barcode.Text;
Imports IronBarCode

' Read the QR code from the image file "qrcode.png"
Private barcode = BarcodeReader.ReadBarcode("qrcode.png", BarcodeEncoding.QRCode)

' Extract the text from the decoded QR code
Private text As String = barcode.Text
$vbLabelText   $csharpLabel

This code reads the QR code from the image file "qrcode.png" and returns the text that was encoded in the barcode.

ZXing.org QR Code Library and IronBarcode: A Comprehensive Comparison: Figure 9 - Scan a Barcode

Step 4: Customize the Barcode

IronBarcode provides a range of customization options that allow you to control the appearance and behavior of the generated barcode scanning implementation.

Here's an example of how to customize a QR code using IronBarcode for barcode scanning implementation:

using IronBarCode;

// Customize a QR code
var barcode = BarcodeWriter.CreateBarcode("Hello, IronBarcode!", BarcodeWriterEncoding.QRCode);
barcode.ResizeTo(400, 400); // Resize the barcode
barcode.SetMargins(20); // Set margins around the barcode
barcode.SetForegroundColor(Color.Black); // Set the foreground color
barcode.SetBackgroundColor(Color.White); // Set the background color
barcode.AddCaptionAbove("Scan me with your smartphone!"); // Add a caption above the barcode
barcode.AddImageLogo("logo.png", 80, 80); // Add a logo to the barcode
barcode.SaveAsImage("qrcode.png"); // Save the customized barcode as an image
using IronBarCode;

// Customize a QR code
var barcode = BarcodeWriter.CreateBarcode("Hello, IronBarcode!", BarcodeWriterEncoding.QRCode);
barcode.ResizeTo(400, 400); // Resize the barcode
barcode.SetMargins(20); // Set margins around the barcode
barcode.SetForegroundColor(Color.Black); // Set the foreground color
barcode.SetBackgroundColor(Color.White); // Set the background color
barcode.AddCaptionAbove("Scan me with your smartphone!"); // Add a caption above the barcode
barcode.AddImageLogo("logo.png", 80, 80); // Add a logo to the barcode
barcode.SaveAsImage("qrcode.png"); // Save the customized barcode as an image
Imports IronBarCode

' Customize a QR code
Private barcode = BarcodeWriter.CreateBarcode("Hello, IronBarcode!", BarcodeWriterEncoding.QRCode)
barcode.ResizeTo(400, 400) ' Resize the barcode
barcode.SetMargins(20) ' Set margins around the barcode
barcode.SetForegroundColor(Color.Black) ' Set the foreground color
barcode.SetBackgroundColor(Color.White) ' Set the background color
barcode.AddCaptionAbove("Scan me with your smartphone!") ' Add a caption above the barcode
barcode.AddImageLogo("logo.png", 80, 80) ' Add a logo to the barcode
barcode.SaveAsImage("qrcode.png") ' Save the customized barcode as an image
$vbLabelText   $csharpLabel

This code generates a QR code with the text "Hello, IronBarcode!" and customizes it by resizing it to 400x400 pixels, adding 20-pixel margins, setting the foreground color to black and the background color to white, adding a caption above the barcode, and adding a logo image.

What IronBarcode Can Do

IronBarcode is built on top of the open-source ZXing library, but it extends its capabilities to support a wider range of barcode types, including QR codes, Code 128, Code 39, EAN-13, EAN-8, UPC-A, and many more.

Here are some of the things that IronBarcode can do:

Generate Barcodes

IronBarcode can easily generate barcodes of various types and styles, including linear and 2D barcodes, with customizable features such as colors, text, and image overlays. The following code snippet generates a QR Code:

var barcode = IronBarCode.BarcodeWriter.CreateBarcode("Hello World!", IronBarCode.BarcodeWriterEncoding.QRCode);
barcode.SaveAsJpeg("QRCode.jpg");
var barcode = IronBarCode.BarcodeWriter.CreateBarcode("Hello World!", IronBarCode.BarcodeWriterEncoding.QRCode);
barcode.SaveAsJpeg("QRCode.jpg");
Dim barcode = IronBarCode.BarcodeWriter.CreateBarcode("Hello World!", IronBarCode.BarcodeWriterEncoding.QRCode)
barcode.SaveAsJpeg("QRCode.jpg")
$vbLabelText   $csharpLabel

ZXing.org QR Code Library and IronBarcode: A Comprehensive Comparison: Figure 10 - Code128 Barcode Image to be Scanned

Read Barcodes

IronBarcode also provides a powerful barcode scanner that can read barcodes from images, PDFs, and live camera streams. The following code reads a QR Code from an image file:

var barcode = IronBarCode.BarcodeReader.Read("QRCode.jpg", IronBarCode.BarcodeReaderEncoding.QRCode);
Console.WriteLine(barcode.Text);
var barcode = IronBarCode.BarcodeReader.Read("QRCode.jpg", IronBarCode.BarcodeReaderEncoding.QRCode);
Console.WriteLine(barcode.Text);
Dim barcode = IronBarCode.BarcodeReader.Read("QRCode.jpg", IronBarCode.BarcodeReaderEncoding.QRCode)
Console.WriteLine(barcode.Text)
$vbLabelText   $csharpLabel

ZXing.org QR Code Library and IronBarcode: A Comprehensive Comparison: Figure 11 - Reading Barcodes Stored Inside PDF

Validate Barcodes

IronBarcode can also validate barcodes to ensure that they are valid and can be scanned by other barcode readers. The following code snippet validates a Code 128 barcode:

var barcode = IronBarCode.BarcodeReader.Read("Code128.jpg", IronBarCode.BarcodeReaderEncoding.Code128);

// Check if the barcode is valid
if (barcode.IsValid)
{
    Console.WriteLine("Barcode is valid.");
}
else
{
    Console.WriteLine("Barcode is invalid.");
}
var barcode = IronBarCode.BarcodeReader.Read("Code128.jpg", IronBarCode.BarcodeReaderEncoding.Code128);

// Check if the barcode is valid
if (barcode.IsValid)
{
    Console.WriteLine("Barcode is valid.");
}
else
{
    Console.WriteLine("Barcode is invalid.");
}
Dim barcode = IronBarCode.BarcodeReader.Read("Code128.jpg", IronBarCode.BarcodeReaderEncoding.Code128)

' Check if the barcode is valid
If barcode.IsValid Then
	Console.WriteLine("Barcode is valid.")
Else
	Console.WriteLine("Barcode is invalid.")
End If
$vbLabelText   $csharpLabel

Convert Barcodes

IronBarcode can convert barcodes from one format to another, such as converting a Code 39 barcode to a QR Code. The following code snippet converts a Code 39 barcode to a QR Code:

var barcode = IronBarCode.BarcodeReader.Read("Code39.jpg", IronBarCode.BarcodeReaderEncoding.Code39);
var qrCode = IronBarCode.BarcodeWriter.CreateBarcode(barcode.Text, IronBarCode.BarcodeWriterEncoding.QRCode);
qrCode.SaveAsJpeg("QRCode.jpg");
var barcode = IronBarCode.BarcodeReader.Read("Code39.jpg", IronBarCode.BarcodeReaderEncoding.Code39);
var qrCode = IronBarCode.BarcodeWriter.CreateBarcode(barcode.Text, IronBarCode.BarcodeWriterEncoding.QRCode);
qrCode.SaveAsJpeg("QRCode.jpg");
Dim barcode = IronBarCode.BarcodeReader.Read("Code39.jpg", IronBarCode.BarcodeReaderEncoding.Code39)
Dim qrCode = IronBarCode.BarcodeWriter.CreateBarcode(barcode.Text, IronBarCode.BarcodeWriterEncoding.QRCode)
qrCode.SaveAsJpeg("QRCode.jpg")
$vbLabelText   $csharpLabel

How IronBarcode is Better than ZXing Decoder Online

Here are some of the ways IronBarcode is better than ZXing:

  1. Performance: IronBarcode is faster than ZXing, making it an excellent choice for web applications that require high-speed barcode scanning and generation.
  2. Ease of use: IronBarcode's API is simple and intuitive, making it easy to create and scan barcodes in just a few lines of code. On the other hand, ZXing's API can be complex and difficult to use for beginners.
  3. Quality of output: IronBarcode produces high-quality barcodes that are easy to read, even at small sizes. In contrast, ZXing's barcodes can sometimes be difficult to read, particularly at smaller sizes.
  4. Supported formats: IronBarcode supports a wide range of barcode formats, including UPC-A, 2D barcodes, and more. In comparison, the ZXing project only supports a limited number of barcode formats.
  5. Licensing: IronBarcode offers a flexible licensing model that allows developers to use the library for free or purchase a license depending on their needs. In contrast, ZXing's licensing is restrictive, making it difficult for developers to use the library in commercial projects.

ZXing.org QR Code Library and IronBarcode: A Comprehensive Comparison: Figure 12 - Reading Barcodes from a Multi-frame TIFF Image

IronBarcode is a superior library to ZXing when it comes to performance, ease of use, output quality, supported formats, and licensing.

See IronBarcode's Superiority for Yourself

Play around with everything IronBarcode has to offer using the free Barcode-Reading Demo below.

IronBarcode Also Offers a Free Trial

Looking to try out IronBarcode and see how it can enhance your barcode scanning and generation capabilities? We're excited to offer a free trial of IronBarcode for you to test out its features and benefits.

During your trial period, you'll have full access to all of IronBarcode's powerful features, including support for a wide range of barcode formats, advanced customization options, and seamless integration with your existing projects.

To start your trial, simply visit our website and download the IronBarcode package. You'll then have free trial to explore all that IronBarcode has to offer and see firsthand how it can streamline your barcode scanning and generation workflows.

Por favor notaZXing is a registered trademark of its respective owner. This site is not affiliated with, endorsed by, or sponsored by ZXing. All product names, logos, and brands are property of their respective owners. Comparisons are for informational purposes only and reflect publicly available information at the time of writing.

Preguntas Frecuentes

¿Cuáles son las limitaciones de usar ZXing para el escaneo de códigos de barras?

ZXing es una biblioteca de código abierto popular para el escaneo de códigos de barras, pero su integración puede ser compleja y puede presentar riesgos potenciales de seguridad. Su soporte de formatos también es limitado en comparación con alternativas comerciales como IronBarcode.

¿Cómo puedo decodificar un código QR en .NET?

Puedes decodificar un código QR en .NET utilizando IronBarcode mediante su clase BarcodeReader, que ofrece una API sencilla para leer e interpretar imágenes de códigos de barras.

¿Cuáles son los beneficios de usar IronBarcode sobre ZXing?

IronBarcode ofrece una experiencia más amigable con un rendimiento más rápido, mayor soporte de formatos, incluyendo soporte para Data Matrix y PDF417, y opciones mejoradas de personalización para la apariencia de los códigos de barras.

¿Cómo puede un desarrollador .NET generar un código de barras con apariencias personalizadas?

Con IronBarcode, los desarrolladores pueden personalizar los códigos de barras al redimensionar, establecer márgenes, cambiar colores, agregar leyendas e incrustar imágenes o logotipos mediante su API flexible.

¿Qué hace de IronBarcode una herramienta versátil para los desarrolladores .NET?

IronBarcode soporta varias plataformas sin dependencias de terceros, ofreciendo un conjunto robusto de herramientas para la generación y escaneo de códigos de barras, incluyendo amplias opciones de personalización y formatos.

¿Cómo integro una biblioteca de códigos de barras en una aplicación .NET?

Para integrar IronBarcode en una aplicación .NET, instálalo a través de NuGet y utiliza su API para generar y escanear códigos de barras de manera eficiente con una configuración mínima.

¿Puedo probar IronBarcode antes de comprarlo?

Sí, puedes descargar una versión de prueba gratuita de IronBarcode desde el sitio web de Iron Software, que proporciona acceso completo a sus funciones durante el período de prueba.

¿Cuáles son las ventajas de las bibliotecas comerciales de códigos de barras?

Las bibliotecas comerciales de códigos de barras como IronBarcode ofrecen mejor rendimiento, facilidad de uso, mayor calidad de salida, soporte de formatos más amplio y licencias más flexibles en comparación con las alternativas de código abierto.

Jordi Bardia
Ingeniero de Software
Jordi es más competente en Python, C# y C++. Cuando no está aprovechando sus habilidades en Iron Software, está programando juegos. Compartiendo responsabilidades para pruebas de productos, desarrollo de productos e investigación, Jordi agrega un valor inmenso a la mejora continua del producto. La experiencia variada lo mantiene ...
Leer más