# How to Read QR Codes from Images in C#
IronQR enables developers to read QR codes from various image formats in C# by loading images with `IronDrawing`, creating a `QrImageInput` object, and using the `QrReader.Read` method to decode the QR data efficiently.
*as-heading:2(Quickstart: Read QR Code from Image in C#)*
<div class="hsg-featured-snippet">
<h2>How to Read QR Code from Images</h2>
<ol>
<li><a class="js-modal-open" data-modal-id="trial-license-after-download" href="https://nuget.org/packages/IronQR/">Download the C# library to read QR codes from images</a></li>
<li>Import the image data using <code>IronDrawing</code></li>
<li>Create a <code>QrImageInput</code> object from the image data</li>
<li>Pass the object to the <code>Read</code> method</li>
<li>Iterate through each detected QR code and review its information</li>
</ol>
</div>
## How Do I Read QR Codes from Different Image Formats?
IronQR provides built-in support for reading QR codes from various image formats. This functionality uses [advanced machine learning models](https://ironsoftware.com/csharp/qr/features/ai/) to ensure accurate decoding across different media types. The supported formats include:
- Joint Photographic Experts Group (JPEG)
- Portable Network Graphics (PNG)
- Graphics Interchange Format (GIF)
- Tagged Image File Format (TIFF)
- Bitmap Image File (BMP)
- WBMP
- WebP
- Icon (ico)
- WMF
- `RawFormat` (raw)
This format support is enabled by the open-source library [IronDrawing](https://ironsoftware.com/open-source/csharp/drawing/docs/), which handles image processing efficiently. You can process QR codes from digital cameras, scanners, mobile devices, or web downloads without format conversion.
<div class="content-img-align-center">
<div class="center-image-wrapper">
<img src="/static-assets/qr/how-to/read-qr-codes-from-image/simpleQrCode.webp" alt="Sample QR code with clear black and white pattern showing positioning squares and data modules for testing image scanning" class="img-responsive add-shadow" />
</div>
</div>
```csharp
:title=Quickstart
// Import necessary IronQR and IronDrawing namespaces
using IronSoftware.Drawing;
using IronQr;
public class QRCodeReader
{
public static void Main()
{
// Load an image from a file path
using (var inputImage = Image.FromFile("path/to/your/image/file.webp"))
{
// Create a QrImageInput object from the image
var qrImageInput = new QrImageInput(inputImage);
// Create a QR Reader and decode the QR code from the image
var reader = new QrReader();
var results = reader.Read(qrImageInput);
// Iterate through each detected QR code and display its information
foreach (var qrResult in results)
{
Console.WriteLine($"QR Code Data: {qrResult.Value}");
}
}
}
}
```
*Note: Replace "path/to/your/image/file.webp" with the actual path to your QR code image file.*
<i>Curious about the QR code value in the sample images? Give it a try using the code snippet!</i>
### Why Does IronQR Support Multiple Image Formats?
Reading a QR code refers to scanning and decoding the information stored within a QR code. This is typically done using a camera or scanner paired with software that can interpret the QR code's data. The information in a QR code could be text, URLs, contact details, or other forms of data.
IronQR's multi-format support is essential for real-world applications where QR codes appear in various contexts - from marketing materials and product packaging to digital documents and web content. By supporting diverse formats, IronQR ensures developers can build reliable applications without worrying about image format compatibility. Learn more about IronQR's [read capabilities](https://ironsoftware.com/csharp/qr/features/read/) to understand how this flexibility enhances your development workflow.
### When Should I Use Each Image Format?
Different image formats serve different purposes in QR code processing:
- **PNG:** Best for QR codes requiring transparency or when image quality is paramount. PNG's lossless compression ensures QR code patterns remain crisp and readable.
- **JPEG:** Ideal for photographs containing QR codes or when file size is a concern. Use higher quality settings (80%+) to prevent compression artifacts from affecting readability.
- **TIFF:** Perfect for archival purposes or when working with scanned documents in enterprise environments.
- **WebP:** Modern format offering excellent compression with quality retention, ideal for web applications.
For optimal results with any format, ensure your images maintain sufficient resolution (at least 300 DPI for printed QR codes) and contrast. Check out our [advanced QR reading examples](https://ironsoftware.com/csharp/qr/examples/read-qr-code-advanced/) for format-specific optimization techniques.
### What Happens If the Image Quality Is Poor?
IronQR incorporates [fault tolerance features](https://ironsoftware.com/csharp/qr/features/fault-tolerance/) to handle imperfect images. When dealing with poor quality images, the library employs several strategies:
1. **Error Correction:** QR codes include error correction capabilities (L, M, Q, H levels), allowing data recovery even when up to 30% of the code is damaged.
2. **Machine Learning Enhancement:** IronQR's ML models detect and compensate for common issues like blur, distortion, and poor lighting.
3. **Preprocessing:** Automatic image enhancement improves contrast and sharpness before decoding attempts.
For challenging scenarios, consider using [custom QR read mode options](https://ironsoftware.com/csharp/qr/examples/read-qr-with-machine-learning/) to fine-tune the reading process:
```csharp
// Example: Reading QR codes from a poor quality image
using IronQr;
public class EnhancedQRReader
{
public static void ReadPoorQualityImage()
{
using (var inputImage = Image.FromFile("blurry_qr_code.jpg"))
{
// Create a QrImageInput and read with a QR Reader
var qrImageInput = new QrImageInput(inputImage);
var reader = new QrReader();
var results = reader.Read(qrImageInput);
foreach (var result in results)
{
Console.WriteLine($"Decoded: {result.Value}");
}
}
}
}
```
<hr />
## Retrieving Values from a QR Code
[//]: # (This is a comment that will be hidden. Value is previously mentioned in the above example. I will take a more explanatory yet brief role when defining it again)
Most IronQR functions return a collection to support multiple detections. Since `results` is a sequence of objects, it does not have a `Value` property itself. The example code specifically selects the first `QrResult` from the collection and retrieves its `Value`.
```csharp
using System;
using System.Collections.Generic;
using System.Linq;
using IronQr;
using System.Drawing;
// Import image
var inputImage = Image.FromFile("sample.jpg");
// Load the asset into QrImageInput
QrImageInput imageInput = new QrImageInput(inputImage);
// Create a QR Reader object
QrReader reader = new QrReader();
// Read the Input an get all embedded QR Codes
IEnumerable<QrResult> results = reader.Read(imageInput);
// Display the value of the first QR code found
Console.WriteLine($"QR code value is {results.First().Value}");
```
<hr />
## Detecting QR Code Position in an image
IronQR goes beyond simple decoding to precisely locate where a QR code sits within an image. This positioning uses a standard coordinate system where `PointF` (0,0) represents the top-left corner of the image. The exact spatial coordinates of the QR code's corners are accessible through the `Points[]` array.
In the example, the coordinates for all four points of the detected QR code are retrieved and printed to the console.
[[i:(The coordinates that are returned by this function are stored in a strict "zig-zag" sequence: top-left, top-right, bottom-left, and finally, bottom-right)]]
```csharp
using System;
using System.Collections.Generic;
using IronQr;
using System.Drawing;
using System.Linq;
// Import an image containing a QR code
var inputImage = Image.FromFile("urlQr.png");
// Load the asset into a QrImageInput object
var imageInput = new QrImageInput(inputImage);
// Create a QR Reader object
var reader = new QrReader();
// Read the input and get all embedded QR codes
IEnumerable<QrResult> results = reader.Read(imageInput);
// [TL, TR, BL, BR]
string[] labels = { "Top-Left", "Top-Right", "Bottom-Left", "Bottom-Right" };
var points = results.First().Points;
for (int i = 0; i < points.Length; i++)
{
Console.WriteLine($"{labels[i]}: {points[i].X}, {points[i].Y}");
}
```
<hr />
### Input QR Code
<div class="content-img-align-center">
<div class="center-image-wrapper">
<img src="/static-assets/qr/how-to/read-qr-codes-from-image/urlQr.webp" alt="QR code" class="img-responsive add-shadow" />
</div>
</div>
### Output
Notice that the system has logged the exact spatial coordinates of every QR code corner to the console.
<div class="content-img-align-center">
<div class="center-image-wrapper">
<img src="/static-assets/qr/how-to/read-qr-codes-from-image/OutputDetection.webp" alt="Edge Detection QR" class="img-responsive add-shadow" />
</div>
</div>
<hr />
## Supported QR Code Types
Multiple types of QR codes are supported for both creation and reading. IronQR provides comprehensive support for various QR code formats to meet diverse application needs. Learn more about [supported QR formats](https://ironsoftware.com/csharp/qr/get-started/supported-qr-formats/) in our documentation. Below are the supported QR code types:
- `QRCode`: The standard QR code most commonly used today. It can store up to 7,089 numeric characters or 4,296 alphanumeric characters, making it suitable for website URLs, contact information, and other applications.
<div class="content-img-align-center">
<div class="center-image-wrapper">
<img src="/static-assets/qr/how-to/read-qr-codes-from-image/simpleQrCode.webp" alt="Sample QR code with clear black and white pattern showing positioning squares and data modules for testing image scanning" class="img-responsive add-shadow" />
</div>
</div>
- `MicroQRCode`: A smaller version of the standard QR code designed for limited space. It can store up to 35 numeric characters or 21 alphanumeric characters, ideal for small packaging or tiny printed labels.
<div class="content-img-align-center">
<div class="center-image-wrapper">
<img src="/static-assets/qr/how-to/read-qr-codes-from-image/MicroQRCode.webp" alt="Standard QR code with finder patterns and data modules demonstrating typical QR code structure" class="img-responsive add-shadow" />
</div>
</div>
- `RMQRCode`: RMQR Code (Rectangular Micro QR Code) is a compact rectangular version rather than square. This version allows flexibility in aspect ratio, useful for applications where rectangular space is available.
<div class="content-img-align-center">
<div class="center-image-wrapper">
<img src="/static-assets/qr/how-to/read-qr-codes-from-image/RMQRCode.webp" alt="Rectangular QR code example showing non-square format with standard positioning markers and data patterns" class="img-responsive add-shadow" />
</div>
</div>
### How Do I Choose the Right QR Code Type?
Selecting the appropriate QR code type depends on your specific use case and constraints:
- **Standard QR Code:** Choose this for general-purpose applications where space isn't limited and you need maximum data capacity. Perfect for URLs, WiFi credentials, vCard contacts, or detailed product information. See our [QR code generation examples](https://ironsoftware.com/csharp/qr/examples/generate-qr-code/) for implementation details.
- **Micro QR Code:** Ideal when working with small surfaces like electronic components, jewelry tags, or medical devices. Despite limited capacity, it's perfect for serial numbers, simple URLs, or basic tracking codes.
- **RMQR Code:** Select rectangular codes when your available space has specific dimensional constraints, such as narrow labels on cylindrical products or elongated spaces on packaging edges.
### What Are the Data Storage Limitations?
Understanding data capacity helps optimize your QR code implementation:
| QR Code Type | Numeric Only | Alphanumeric | Binary | Kanji |
|--------------|-------------|--------------|---------|--------|
| Standard QR | 7,089 | 4,296 | 2,953 | 1,817 |
| Micro QR | 35 | 21 | 15 | 9 |
| RMQR | Variable | Variable | Variable | Variable |
Consider these factors when planning data storage:
- Use URL shorteners for web links to maximize available space
- Implement data compression for large datasets
- Choose appropriate error correction levels (higher correction reduces capacity)
For advanced implementations, explore our [styled QR code generation guide](https://ironsoftware.com/csharp/qr/examples/generate-styled-qr/) to balance aesthetics with data capacity.
### When Should I Use Micro or RMQR Codes?
Micro and RMQR codes excel in specific scenarios:
**Micro QR Codes are perfect for:**
- Electronic circuit boards requiring component tracking
- Small medical devices needing patient or medication identifiers
- Jewelry authentication with limited engraving space
- Miniature product labels in manufacturing
**RMQR Codes work best for:**
- Narrow shipping labels on tubes or pipes
- Elongated spaces on pen barrels or tools
- Banner-style marketing materials
- Integration into existing rectangular design elements
Here's a practical example for reading different QR code types:
```csharp
using IronQr;
using IronSoftware.Drawing;
public class MultiTypeQRReader
{
public static void ReadVariousQRTypes()
{
string[] imagePaths = {
"standard_qr.png",
"micro_qr.png",
"rectangular_qr.png"
};
// Create a QR Reader that handles all QR code types
var reader = new QrReader();
foreach (var path in imagePaths)
{
using (var image = Image.FromFile(path))
{
var qrInput = new QrImageInput(image);
var results = reader.Read(qrInput);
foreach (var qr in results)
{
Console.WriteLine($"Type: {qr.QrType}");
Console.WriteLine($"Data: {qr.Value}");
Console.WriteLine("---");
}
}
}
}
}
```
For production deployments, review our [NuGet packages guide](https://ironsoftware.com/csharp/qr/get-started/nuget-packages/) to ensure you have the right package for your platform, and check the [API reference](https://ironsoftware.com/csharp/qr/object-reference/api/) for comprehensive documentation on all available methods and properties.
IronQR enables developers to read QR codes from various image formats in C# by loading images with IronDrawing, creating a QrImageInput object, and using the QrReader.Read method to decode the QR data efficiently.
Iterate through each detected QR code and review its information
How Do I Read QR Codes from Different Image Formats?
IronQR provides built-in support for reading QR codes from various image formats. This functionality uses advanced machine learning models to ensure accurate decoding across different media types. The supported formats include:
Joint Photographic Experts Group (JPEG)
Portable Network Graphics (PNG)
Graphics Interchange Format (GIF)
Tagged Image File Format (TIFF)
Bitmap Image File (BMP)
WBMP
WebP
Icon (ico)
WMF
RawFormat (raw)
This format support is enabled by the open-source library IronDrawing, which handles image processing efficiently. You can process QR codes from digital cameras, scanners, mobile devices, or web downloads without format conversion.
1Install IronQR with NuGet Package Manager
PM > Install-Package IronQR
Install-Package IronQR
2Copy and run this code snippet.
// Import necessary IronQR and IronDrawing namespacesusing IronSoftware.Drawing; using IronQr;public class QRCodeReader{ public static voidMain() { // Load an image from a file path using (var inputImage = Image.FromFile("path/to/your/image/file.webp")) { // Create a QrImageInput object from the image var qrImageInput = new QrImageInput(inputImage); // Create a QR Reader and decode the QR code from the image var reader = new QrReader(); var results = reader.Read(qrImageInput); // Iterate through each detected QR code and display its information foreach (var qrResult in results) {Console.WriteLine($"QR Code Data: {qrResult.Value}"); } } }}
// Import necessary IronQR and IronDrawing namespaces
using IronSoftware.Drawing;
using IronQr;
public class QRCodeReader
{
public static void Main()
{
// Load an image from a file path
using (var inputImage = Image.FromFile("path/to/your/image/file.webp"))
{
// Create a QrImageInput object from the image
var qrImageInput = new QrImageInput(inputImage);
// Create a QR Reader and decode the QR code from the image
var reader = new QrReader();
var results = reader.Read(qrImageInput);
// Iterate through each detected QR code and display its information
foreach (var qrResult in results)
{
Console.WriteLine($"QR Code Data: {qrResult.Value}");
}
}
}
}
C#
3Deploy to test on your live environment
Start using IronQR in your project today with a free trial
Note: Replace "path/to/your/image/file.webp" with the actual path to your QR code image file.
Curious about the QR code value in the sample images? Give it a try using the code snippet!
Why Does IronQR Support Multiple Image Formats?
Reading a QR code refers to scanning and decoding the information stored within a QR code. This is typically done using a camera or scanner paired with software that can interpret the QR code's data. The information in a QR code could be text, URLs, contact details, or other forms of data.
IronQR's multi-format support is essential for real-world applications where QR codes appear in various contexts - from marketing materials and product packaging to digital documents and web content. By supporting diverse formats, IronQR ensures developers can build reliable applications without worrying about image format compatibility. Learn more about IronQR's read capabilities to understand how this flexibility enhances your development workflow.
When Should I Use Each Image Format?
Different image formats serve different purposes in QR code processing:
PNG: Best for QR codes requiring transparency or when image quality is paramount. PNG's lossless compression ensures QR code patterns remain crisp and readable.
JPEG: Ideal for photographs containing QR codes or when file size is a concern. Use higher quality settings (80%+) to prevent compression artifacts from affecting readability.
TIFF: Perfect for archival purposes or when working with scanned documents in enterprise environments.
WebP: Modern format offering excellent compression with quality retention, ideal for web applications.
For optimal results with any format, ensure your images maintain sufficient resolution (at least 300 DPI for printed QR codes) and contrast. Check out our advanced QR reading examples for format-specific optimization techniques.
What Happens If the Image Quality Is Poor?
IronQR incorporates fault tolerance features to handle imperfect images. When dealing with poor quality images, the library employs several strategies:
Error Correction: QR codes include error correction capabilities (L, M, Q, H levels), allowing data recovery even when up to 30% of the code is damaged.
Machine Learning Enhancement: IronQR's ML models detect and compensate for common issues like blur, distortion, and poor lighting.
Preprocessing: Automatic image enhancement improves contrast and sharpness before decoding attempts.
// Example: Reading QR codes from a poor quality imageusing IronQr;public class EnhancedQRReader{ public static voidReadPoorQualityImage() { using (var inputImage = Image.FromFile("blurry_qr_code.jpg")) { // Create a QrImageInput and read with a QR Reader var qrImageInput = new QrImageInput(inputImage); var reader = new QrReader(); var results = reader.Read(qrImageInput); foreach (var result in results) {Console.WriteLine($"Decoded: {result.Value}"); } } }}
// Example: Reading QR codes from a poor quality image
using IronQr;
public class EnhancedQRReader
{
public static void ReadPoorQualityImage()
{
using (var inputImage = Image.FromFile("blurry_qr_code.jpg"))
{
// Create a QrImageInput and read with a QR Reader
var qrImageInput = new QrImageInput(inputImage);
var reader = new QrReader();
var results = reader.Read(qrImageInput);
foreach (var result in results)
{
Console.WriteLine($"Decoded: {result.Value}");
}
}
}
}
C#
Retrieving Values from a QR Code
Most IronQR functions return a collection to support multiple detections. Since results is a sequence of objects, it does not have a Value property itself. The example code specifically selects the first QrResult from the collection and retrieves its Value.
using System;using System.Collections.Generic;using System.Linq;using IronQr;using System.Drawing;// Import imagevar inputImage = Image.FromFile("sample.jpg");// Load the asset into QrImageInputQrImageInput imageInput = new QrImageInput(inputImage);// Create a QR Reader objectQrReader reader = new QrReader();// Read the Input an get all embedded QR CodesIEnumerable<QrResult> results = reader.Read(imageInput);// Display the value of the first QR code foundConsole.WriteLine($"QR code value is {results.First().Value}");
using System;
using System.Collections.Generic;
using System.Linq;
using IronQr;
using System.Drawing;
// Import image
var inputImage = Image.FromFile("sample.jpg");
// Load the asset into QrImageInput
QrImageInput imageInput = new QrImageInput(inputImage);
// Create a QR Reader object
QrReader reader = new QrReader();
// Read the Input an get all embedded QR Codes
IEnumerable<QrResult> results = reader.Read(imageInput);
// Display the value of the first QR code found
Console.WriteLine($"QR code value is {results.First().Value}");
ImportsSystemImportsSystem.Collections.GenericImportsSystem.LinqImportsIronQrImportsSystem.Drawing' Import imageDim inputImage AsImage = Image.FromFile("sample.jpg")' Load the asset into QrImageInputDim imageInput As New QrImageInput(inputImage)' Create a QR Reader objectDim reader As New QrReader()' Read the Input and get all embedded QR CodesDim results AsIEnumerable(OfQrResult) = reader.Read(imageInput)' Display the value of the first QR code foundConsole.WriteLine($"QR code value is {results.First().Value}")
Imports System
Imports System.Collections.Generic
Imports System.Linq
Imports IronQr
Imports System.Drawing
' Import image
Dim inputImage As Image = Image.FromFile("sample.jpg")
' Load the asset into QrImageInput
Dim imageInput As New QrImageInput(inputImage)
' Create a QR Reader object
Dim reader As New QrReader()
' Read the Input and get all embedded QR Codes
Dim results As IEnumerable(Of QrResult) = reader.Read(imageInput)
' Display the value of the first QR code found
Console.WriteLine($"QR code value is {results.First().Value}")
Detecting QR Code Position in an image
IronQR goes beyond simple decoding to precisely locate where a QR code sits within an image. This positioning uses a standard coordinate system where PointF (0,0) represents the top-left corner of the image. The exact spatial coordinates of the QR code's corners are accessible through the Points[] array.
In the example, the coordinates for all four points of the detected QR code are retrieved and printed to the console.
Please note: The coordinates that are returned by this function are stored in a strict "zig-zag" sequence: top-left, top-right, bottom-left, and finally, bottom-right
using System;using System.Collections.Generic;using IronQr;using System.Drawing;using System.Linq;// Import an image containing a QR codevar inputImage = Image.FromFile("urlQr.png");// Load the asset into a QrImageInput objectvar imageInput = new QrImageInput(inputImage);// Create a QR Reader objectvar reader = new QrReader();// Read the input and get all embedded QR codesIEnumerable<QrResult> results = reader.Read(imageInput);// [TL, TR, BL, BR]string[] labels = { "Top-Left", "Top-Right", "Bottom-Left", "Bottom-Right" };var points = results.First().Points;for (int i = 0; i < points.Length; i++){Console.WriteLine($"{labels[i]}: {points[i].X}, {points[i].Y}");}
using System;
using System.Collections.Generic;
using IronQr;
using System.Drawing;
using System.Linq;
// Import an image containing a QR code
var inputImage = Image.FromFile("urlQr.png");
// Load the asset into a QrImageInput object
var imageInput = new QrImageInput(inputImage);
// Create a QR Reader object
var reader = new QrReader();
// Read the input and get all embedded QR codes
IEnumerable<QrResult> results = reader.Read(imageInput);
// [TL, TR, BL, BR]
string[] labels = { "Top-Left", "Top-Right", "Bottom-Left", "Bottom-Right" };
var points = results.First().Points;
for (int i = 0; i < points.Length; i++)
{
Console.WriteLine($"{labels[i]}: {points[i].X}, {points[i].Y}");
}
ImportsSystemImportsSystem.Collections.GenericImportsIronQrImportsSystem.DrawingImportsSystem.Linq' Import an image containing a QR codeDim inputImage AsImage = Image.FromFile("urlQr.png")' Load the asset into a QrImageInput objectDim imageInput As New QrImageInput(inputImage)' Create a QR Reader objectDim reader As New QrReader()' Read the input and get all embedded QR codesDim results AsIEnumerable(OfQrResult) = reader.Read(imageInput)' [TL, TR, BL, BR]Dim labels AsString() = { "Top-Left", "Top-Right", "Bottom-Left", "Bottom-Right" }Dim points = results.First().PointsFor i AsInteger = 0 To points.Length - 1Console.WriteLine($"{labels(i)}: {points(i).X}, {points(i).Y}")Next
Imports System
Imports System.Collections.Generic
Imports IronQr
Imports System.Drawing
Imports System.Linq
' Import an image containing a QR code
Dim inputImage As Image = Image.FromFile("urlQr.png")
' Load the asset into a QrImageInput object
Dim imageInput As New QrImageInput(inputImage)
' Create a QR Reader object
Dim reader As New QrReader()
' Read the input and get all embedded QR codes
Dim results As IEnumerable(Of QrResult) = reader.Read(imageInput)
' [TL, TR, BL, BR]
Dim labels As String() = { "Top-Left", "Top-Right", "Bottom-Left", "Bottom-Right" }
Dim points = results.First().Points
For i As Integer = 0 To points.Length - 1
Console.WriteLine($"{labels(i)}: {points(i).X}, {points(i).Y}")
Next
Input QR Code
Output
Notice that the system has logged the exact spatial coordinates of every QR code corner to the console.
Supported QR Code Types
Multiple types of QR codes are supported for both creation and reading. IronQR provides comprehensive support for various QR code formats to meet diverse application needs. Learn more about supported QR formats in our documentation. Below are the supported QR code types:
QRCode: The standard QR code most commonly used today. It can store up to 7,089 numeric characters or 4,296 alphanumeric characters, making it suitable for website URLs, contact information, and other applications.
MicroQRCode: A smaller version of the standard QR code designed for limited space. It can store up to 35 numeric characters or 21 alphanumeric characters, ideal for small packaging or tiny printed labels.
RMQRCode: RMQR Code (Rectangular Micro QR Code) is a compact rectangular version rather than square. This version allows flexibility in aspect ratio, useful for applications where rectangular space is available.
How Do I Choose the Right QR Code Type?
Selecting the appropriate QR code type depends on your specific use case and constraints:
Standard QR Code: Choose this for general-purpose applications where space isn't limited and you need maximum data capacity. Perfect for URLs, WiFi credentials, vCard contacts, or detailed product information. See our QR code generation examples for implementation details.
Micro QR Code: Ideal when working with small surfaces like electronic components, jewelry tags, or medical devices. Despite limited capacity, it's perfect for serial numbers, simple URLs, or basic tracking codes.
RMQR Code: Select rectangular codes when your available space has specific dimensional constraints, such as narrow labels on cylindrical products or elongated spaces on packaging edges.
What Are the Data Storage Limitations?
Understanding data capacity helps optimize your QR code implementation:
QR Code Type
Numeric Only
Alphanumeric
Binary
Kanji
Standard QR
7,089
4,296
2,953
1,817
Micro QR
35
21
15
9
RMQR
Variable
Variable
Variable
Variable
Consider these factors when planning data storage:
Use URL shorteners for web links to maximize available space
Small medical devices needing patient or medication identifiers
Jewelry authentication with limited engraving space
Miniature product labels in manufacturing
RMQR Codes work best for:
Narrow shipping labels on tubes or pipes
Elongated spaces on pen barrels or tools
Banner-style marketing materials
Integration into existing rectangular design elements
Here's a practical example for reading different QR code types:
using IronQr;using IronSoftware.Drawing;public class MultiTypeQRReader{ public static voidReadVariousQRTypes() { string[] imagePaths = { "standard_qr.png", "micro_qr.png", "rectangular_qr.png" }; // Create a QR Reader that handles all QR code types var reader = new QrReader(); foreach (var path in imagePaths) { using (var image = Image.FromFile(path)) { var qrInput = new QrImageInput(image); var results = reader.Read(qrInput); foreach (var qr in results) {Console.WriteLine($"Type: {qr.QrType}");Console.WriteLine($"Data: {qr.Value}");Console.WriteLine("---"); } } } }}
using IronQr;
using IronSoftware.Drawing;
public class MultiTypeQRReader
{
public static void ReadVariousQRTypes()
{
string[] imagePaths = {
"standard_qr.png",
"micro_qr.png",
"rectangular_qr.png"
};
// Create a QR Reader that handles all QR code types
var reader = new QrReader();
foreach (var path in imagePaths)
{
using (var image = Image.FromFile(path))
{
var qrInput = new QrImageInput(image);
var results = reader.Read(qrInput);
foreach (var qr in results)
{
Console.WriteLine($"Type: {qr.QrType}");
Console.WriteLine($"Data: {qr.Value}");
Console.WriteLine("---");
}
}
}
}
}
C#
For production deployments, review our NuGet packages guide to ensure you have the right package for your platform, and check the API reference for comprehensive documentation on all available methods and properties.
Frequently Asked Questions
How can I read QR codes from different image formats using IronQR?
IronQR supports reading QR codes from a wide range of image formats including JPEG, PNG, GIF, and more. This is achieved through advanced machine learning models that ensure accurate decoding across various media types, enabled by the IronDrawing library for efficient image processing.
What steps are involved in reading a QR code from an image in C# using IronQR?
To read a QR code from an image using IronQR, you need to download the IronQR library, import image data with IronDrawing, create a QrImageInput object, pass it to the QrReader.Read method, and iterate through each detected QR code to review its information.
Why is it important for IronQR to support multiple image formats?
Supporting multiple image formats allows IronQR to be versatile in real-world applications, where QR codes can be present in diverse contexts such as marketing materials, product packaging, digital documents, and web content. This ensures that developers can build applications without format compatibility issues.
What image format should I use for reading QR codes with IronQR?
The choice of image format depends on your needs. Use PNG for QR codes needing transparency, JPEG for photographs with QR codes, TIFF for archival purposes, and WebP for web applications due to its excellent compression. Ensure images have sufficient resolution and contrast for best results.
How does IronQR handle poor quality images?
IronQR uses fault tolerance features like error correction and machine learning models to compensate for issues like blur or poor lighting. It automatically enhances image contrast and sharpness, and offers custom QR read mode options for challenging conditions.
What types of QR codes can IronQR read?
IronQR can read various types of QR codes, including Standard QR Code, Micro QR Code, and RMQR Code, supporting different use cases and data capacities for applications requiring compact or rectangular formats.
When should I choose Micro or RMQR codes?
Choose Micro QR codes for small surfaces like circuit boards or medical devices and RMQR codes for rectangular labels like narrow shipping labels or marketing materials that require fitting into elongated spaces.
How does IronQR locate a QR code within an image?
IronQR uses a standard coordinate system to pinpoint where a QR code is located within an image. It retrieves and prints the exact spatial coordinates of the QR code's corners using the Points[] array.
Curtis Chau holds a Bachelor’s degree in Computer Science (Carleton University) and specializes in front-end development with expertise in Node.js, TypeScript, JavaScript, and React. Passionate about crafting intuitive and aesthetically pleasing user interfaces, Curtis enjoys working with modern frameworks and creating well-structured, visually appealing manuals.