A comparison of IronBarcode and the ZXing Net library

In this tutorial, we delve into generating QR codes using the ZXing (a.k.a. Z Crossing) and IronBarcode libraries in Visual Studio 2022. The process starts with setting up the environment by installing necessary packages via the NuGet Package Manager. Initially, we use the ZXing library to create a QR code by configuring its options, generating pixel data, and saving the QR code as a PNG file. This method allows us to encode URLs like apkzombie.com into QR codes. Next, we explore the IronBarcode library, which offers advanced customization features such as styling, color changes, and logo addition. The IronBarcode library requires setting a license key and provides the ability to read and decode QR codes with ease. The tutorial compares both libraries, highlighting IronBarcode’s superior customization options and ease of use. Finally, viewers are encouraged to subscribe for more tutorials and reach out to Iron Software's support team for assistance.

// Using ZXing to generate a simple QR code
using System;
using ZXing;
using ZXing.Common;
using ZXing.Rendering;
using System.Drawing;
using System.Drawing.Imaging;

namespace QRCodeExample
{
    class Program
    {
        static void Main(string[] args)
        {
            var writer = new BarcodeWriter
            {
                Format = BarcodeFormat.QR_CODE,
                Options = new EncodingOptions
                {
                    Height = 250,
                    Width = 250
                },
                Renderer = new BitmapRenderer()
            };

            // Encode sample text into a QR code
            Bitmap qrCodeBitmap = writer.Write("https://apkzombie.com");

            // Save the QR code as a PNG file
            qrCodeBitmap.Save("QRCode.png", ImageFormat.Png);

            Console.WriteLine("QR code generated and saved as QRCode.png.");
        }
    }
}
// Using ZXing to generate a simple QR code
using System;
using ZXing;
using ZXing.Common;
using ZXing.Rendering;
using System.Drawing;
using System.Drawing.Imaging;

namespace QRCodeExample
{
    class Program
    {
        static void Main(string[] args)
        {
            var writer = new BarcodeWriter
            {
                Format = BarcodeFormat.QR_CODE,
                Options = new EncodingOptions
                {
                    Height = 250,
                    Width = 250
                },
                Renderer = new BitmapRenderer()
            };

            // Encode sample text into a QR code
            Bitmap qrCodeBitmap = writer.Write("https://apkzombie.com");

            // Save the QR code as a PNG file
            qrCodeBitmap.Save("QRCode.png", ImageFormat.Png);

            Console.WriteLine("QR code generated and saved as QRCode.png.");
        }
    }
}
' Using ZXing to generate a simple QR code
Imports System
Imports ZXing
Imports ZXing.Common
Imports ZXing.Rendering
Imports System.Drawing
Imports System.Drawing.Imaging

Namespace QRCodeExample
	Friend Class Program
		Shared Sub Main(ByVal args() As String)
			Dim writer = New BarcodeWriter With {
				.Format = BarcodeFormat.QR_CODE,
				.Options = New EncodingOptions With {
					.Height = 250,
					.Width = 250
				},
				.Renderer = New BitmapRenderer()
			}

			' Encode sample text into a QR code
			Dim qrCodeBitmap As Bitmap = writer.Write("https://apkzombie.com")

			' Save the QR code as a PNG file
			qrCodeBitmap.Save("QRCode.png", ImageFormat.Png)

			Console.WriteLine("QR code generated and saved as QRCode.png.")
		End Sub
	End Class
End Namespace
$vbLabelText   $csharpLabel
// Using IronBarcode for enhanced QR code features
using System;
using IronBarCode;

namespace QRCodeExample
{
    class Program
    {
        static void Main(string[] args)
        {
            // License key setup for IronBarcode (replace with your license key)
            // License.LicenseKey = "YOUR-LICENSE-KEY";

            // Create a simple QR code
            var qrCode = QRCodeWriter.CreateQrCode("https://apkzombie.com", 250);

            // Customize the QR code (e.g., adding a logo, changing colors)
            qrCode.ChangeBarCodeColor(System.Drawing.Color.FromArgb(0, 0, 128)); // Dark blue code color
            qrCode.ChangeBackgroundColor(System.Drawing.Color.FromArgb(255, 255, 255)); // White background

            // Save the QR code as an image
            qrCode.SaveAsPng("CustomQRCode.png");

            Console.WriteLine("Custom QR code generated and saved as CustomQRCode.png.");
        }
    }
}
// Using IronBarcode for enhanced QR code features
using System;
using IronBarCode;

namespace QRCodeExample
{
    class Program
    {
        static void Main(string[] args)
        {
            // License key setup for IronBarcode (replace with your license key)
            // License.LicenseKey = "YOUR-LICENSE-KEY";

            // Create a simple QR code
            var qrCode = QRCodeWriter.CreateQrCode("https://apkzombie.com", 250);

            // Customize the QR code (e.g., adding a logo, changing colors)
            qrCode.ChangeBarCodeColor(System.Drawing.Color.FromArgb(0, 0, 128)); // Dark blue code color
            qrCode.ChangeBackgroundColor(System.Drawing.Color.FromArgb(255, 255, 255)); // White background

            // Save the QR code as an image
            qrCode.SaveAsPng("CustomQRCode.png");

            Console.WriteLine("Custom QR code generated and saved as CustomQRCode.png.");
        }
    }
}
' Using IronBarcode for enhanced QR code features
Imports System
Imports IronBarCode

Namespace QRCodeExample
	Friend Class Program
		Shared Sub Main(ByVal args() As String)
			' License key setup for IronBarcode (replace with your license key)
			' License.LicenseKey = "YOUR-LICENSE-KEY";

			' Create a simple QR code
			Dim qrCode = QRCodeWriter.CreateQrCode("https://apkzombie.com", 250)

			' Customize the QR code (e.g., adding a logo, changing colors)
			qrCode.ChangeBarCodeColor(System.Drawing.Color.FromArgb(0, 0, 128)) ' Dark blue code color
			qrCode.ChangeBackgroundColor(System.Drawing.Color.FromArgb(255, 255, 255)) ' White background

			' Save the QR code as an image
			qrCode.SaveAsPng("CustomQRCode.png")

			Console.WriteLine("Custom QR code generated and saved as CustomQRCode.png.")
		End Sub
	End Class
End Namespace
$vbLabelText   $csharpLabel

Further Reading: A comparison of IronBarcode and the ZXing Net library

Jordi Bardia
Software Engineer
Jordi is most proficient in Python, C# and C++, when he isn’t leveraging his skills at Iron Software; he’s game programming. Sharing responsibilities for product testing, product development and research, Jordi adds immense value to continual product improvement. The varied experience keeps him challenged and engaged, and he says it’s one of his favorite aspects of working with Iron Software. Jordi grew up in Miami, Florida and studied Computer Science and Statistics at University of Florida.
< PREVIOUS
How to Create Barcodes in ASP .NET with IronBarcode