QR codes are everywhere—on business cards, product packaging, invoices, websites, and more. For developers, integrating QR code generation and reading into applications can streamline processes like payment, authentication, and data transfer. IronQR, a C#/.NET library by Iron Software, offers a simple, high-performance, and highly customizable way to generate and read QR codes across platforms like Windows, macOS, Linux, Docker, Azure, and mobile.
In this guide, you'll learn how to use IronQR to generate QR codes with logos and styles, read various QR formats from multiple image types, and leverage advanced features like error correction and machine learning-enhanced recognition.
🔧 Installation & Compatibility
To get started, install the latest version via NuGet (as of May 2025, v2025.5.4):
Using Package Manager Console:
Install-Package IronQR
Or via .NET CLI:
dotnet add package IronQr
IronQR supports:
- .NET: 8, 7, 6, 5, Core 2.0–3.1, Standard 2.0, Framework 4.6.2+
- Platforms: Windows, macOS, Linux, Docker, Azure, AWS, iOS (12+), Android (API 21+)
- Image Formats: JPEG, PNG, TIFF, BMP, GIF, WebP, ICO, SVG, multipage images (TIFF, GIF)
✍️ Generating a Basic QR Code
Let’s start with the simplest use case: generating a standard black-and-white QR code that contains a URL. This is ideal for linking to websites, login portals, or app downloads.
using IronQr;
using IronSoftware.Drawing;
// Generate QR code from string
QrCode myQr = QrWriter.Write("https://example.com");
// Save the QR image to a bitmap
AnyBitmap qrImage = myQr.Save();
// Export the bitmap to a PNG file
qrImage.SaveAs("qr.png");
Explanation:
In this code, we generate a basic QR code from a URL using QrWriter.Write()
. We then save the resulting QR image into an AnyBitmap
using myQr.Save()
, which handles image formatting via IronSoftware.Drawing
. Finally, we persist the image to disk as a .png
file using SaveAs()
. This QR code can now be scanned using any standard QR reader.
📷 Reading QR Code from Image
Now let's switch to reading QR codes. IronQR can decode QR codes from various image formats like PNG, JPEG, GIF, WebP, and more—even from imperfect or skewed images.
// Load QR code image into AnyBitmap
AnyBitmap qrBitmap = AnyBitmap.FromFile("qr.png");
var qrInput = new QrImageInput(qrBitmap);
// Create reader and scan for QR codes
var reader = new QrReader();
IEnumerable<QrResult> results = reader.Read(qrInput);
// Output results
if (results.Any())
{
foreach (var result in results)
{
Console.WriteLine($"Type: {result.QrType}");
Console.WriteLine($"Value: {result.Value}");
}
}
else
{
Console.WriteLine("No QR code found in the image.");
}
This snippet reads a QR code from an image file using AnyBitmap
and QrImageInput
. The QrReader
scans the image and returns a list of results, which you can iterate to extract both the QR format and value. This approach supports multi-frame images and works even if the QR code is partially damaged.
🎯 ML-Powered Accuracy with Flexible Scan Modes
IronQR leverages custom Machine Learning models to accurately read QR codes—even from distorted, low-light, or noisy images. This is especially useful in real-world conditions such as scanning from camera feeds, printed documents, or screenshots. Developers can choose from multiple scanning strategies using QrScanMode
to balance between accuracy and speed.
using IronQr;
using IronSoftware.Drawing;
using IronQr.Enum;
using System.Collections.Generic;
// Load the image containing one or more QR codes
var inputBmp = AnyBitmap.FromFile("IMAGE_TO_READ.png");
// 1. Auto Mode: Combines ML and classic scan (most reliable)
QrImageInput scan_ML_and_normal = new QrImageInput(inputBmp, QrScanMode.Auto);
IEnumerable<QrResult> results1 = new QrReader().Read(scan_ML_and_normal);
// 2. ML Only: Fastest for camera feed or video frames
QrImageInput scan_ML_only = new QrImageInput(inputBmp, QrScanMode.OnlyDetectionModel);
IEnumerable<QrResult> results2 = new QrReader().Read(scan_ML_only);
// 3. Basic Scan Only: Use when high speed is needed and quality is clean
QrImageInput scan_normal_only = new QrImageInput(inputBmp, QrScanMode.OnlyBasicScan);
IEnumerable<QrResult> results3 = new QrReader().Read(scan_normal_only);
This example demonstrates IronQR’s three scanning strategies. QrScanMode.Auto
combines both ML and traditional scanning for maximum reliability. OnlyDetectionModel
uses just the ML model for faster performance, perfect for camera input. OnlyBasicScan
disables ML for scenarios where the image is already high-quality and you want minimal processing time. This flexibility ensures robust accuracy and performance control across diverse real-world use cases.
📍 Reading Advanced QR Code
IronQR not only extracts text from QR codes—it also gives access to structured data such as embedded URLs and precise location coordinates. This is especially useful in layout-sensitive applications, such as reading multiple QR codes from a form or dynamically locating their positions for overlays and annotations.
using IronQr;
using IronSoftware.Drawing;
using System;
using System.Collections.Generic;
// Open the asset to read a QR Code from
var inputBmp = AnyBitmap.FromFile("IMAGE_TO_READ.png");
// Load the asset into QrImageInput
QrImageInput imageInput = new QrImageInput(inputBmp);
// Create a QR Reader object
QrReader reader = new QrReader();
// Read the Input and get all embedded QR Codes
IEnumerable<QrResult> results = reader.Read(imageInput);
// Use and Store the information as required
foreach (QrResult result in results)
{
// String value of the QR Code
Console.WriteLine(result.Value);
// URI value of the QR Code
Console.WriteLine(result.Url);
// Coordinates of the QR Code
foreach (IronSoftware.Drawing.PointF point in result.Points)
{
Console.WriteLine($"{point.X}, {point.Y}");
}
}
In this example, we use QrReader
to process an image and extract multiple layers of data. The Value
gives the decoded string content, while Url
attempts to parse the string as a URI if applicable. The Points
property contains the precise pixel coordinates of the QR code’s corners, which can be leveraged for bounding box visualization, layout-aware scanning, or mapping interactions. This makes IronQR ideal for applications requiring deep QR analysis or positional awareness.
🔍 Supported Image and QR Code Formats
Image Types:
- PNG, JPG, BMP, GIF, TIFF, WebP, ICO, SVG
- Multipage: Multi-frame GIFs, multi-page TIFFs
QR Formats:
- Standard QR Code
- Micro QR Code
- Rectangular Micro QR Code (rMQR)
IronQR automatically detects these formats, no manual selection required.
🏁 Key Features Summary
- ✅ Generate & read QR codes in C# with zero dependencies
- 🎯 Supports logos, custom styles, annotations, margins, and colors
- 🧠 Machine Learning-powered decoding with fault tolerance
- 🖼️ Reads all common image formats: PNG, JPEG, TIFF, SVG, WebP
- 📦 NuGet package compatible with .NET 8, 7, 6, Core 2.x, Framework 4.6.2+
- 🌍 Works on Windows, macOS, Linux, Docker, Azure, AWS, iOS, Android
📎 Resources
🧩 Conclusion: Fast, Flexible, and Future-Ready QR Integration
IronQR stands out as a robust and developer-friendly solution for both generating and reading QR codes in .NET applications. Whether you need to scan multiple formats across diverse platforms or generate custom-styled QR codes for branding and business logic, IronQR delivers reliable, high-performance results with minimal code.
Thanks to its machine learning-powered accuracy, extensive support for image formats and QR code variants, and compatibility with .NET 8, .NET 7, .NET 6, .NET 5, Core, Standard, and Framework, it’s ready for use in everything from desktop software to cross-platform mobile and cloud apps.
🆓 Free Trial & Licensing
IronQR is commercially licensed and offers a fully functional free trial so you can evaluate it with no restrictions on capabilities. Licenses are available for individual developers, small teams, and enterprise use—making it easy to scale with your project.
Top comments (0)