How to Read QR Codes with Different Scanning Modes
Reading QR codes has become a routine task as more products move toward digitization and always-online access. Storing necessary data in compact, read-only imprints is now the standard, and developers need effective ways to extract that information in different environments.
IronQR provides 3 read options for QR codes, each designed for specific use cases.
In this how-to guide, all three methods will be explained with clear examples. If you haven't checked it out yet, take a look at the previous guide on reading QR codes from images or writing your own QR code.
How to Read QR Codes with Different Scan Modes
- Download the C# library to read QR codes with advanced scanning options
- Load the target image file
- Initialize a
QrImageInputpassing the image and the requiredQrScanMode - Instantiate the
QrReaderclass and pass the input object to theReadmethod - Retrieve the results to access the decoded
Valuetext or iterate through thePointsarray for coordinate data.
Understanding QR Code Scanning Modes
IronQR offers three powerful scanning modes through the QrScanMode enumeration:
- Auto Mode (
QrScanMode.Auto): combines both machine learning detection and basic scanning algorithms for maximum accuracy and reliability - Only Basic Scan Mode (
QrScanMode.OnlyBasicScan): uses conventional image processing techniques for fast, reliable scanning when QR codes are clearly visible - Detection Model Mode (
QrScanMode.OnlyDetectionModel): Leverages machine learning to detect QR code positions, ideal for extracting coordinate data
Let's explore each scanning method in detail.
Only Basic Scan Mode
Only Basic Scan mode uses traditional image processing algorithms without the use of machine learning. This method is fast and efficient when QR codes are clearly visible and well-positioned; however, it still works on damaged QRs if the three corner squares are readable.
using IronQr;
using IronQr.Enum;
using IronSoftware.Drawing;
using System.IO;
using System.Linq;
// Load the image
var bmp = AnyBitmap.FromFile("damaged-qr.png");
// Create scan input using Only Basic Scan mode
var input = new QrImageInput(bmp, QrScanMode.OnlyBasicScan);
// Get the result
var result = new QrReader().Read(input).FirstOrDefault();
// Save the output to a text file
File.WriteAllText("basic-scan-output.txt", result.Value);Imports IronQr
Imports IronQr.Enum
Imports IronSoftware.Drawing
Imports System.IO
Imports System.Linq
' Load the image
Dim bmp = AnyBitmap.FromFile("damaged-qr.png")
' Create scan input using Only Basic Scan mode
Dim input = New QrImageInput(bmp, QrScanMode.OnlyBasicScan)
' Get the result
Dim result = (New QrReader()).Read(input).FirstOrDefault()
' Save the output to a text file
File.WriteAllText("basic-scan-output.txt", result.Value)Scan input

Saved text file

Auto Scan Mode
Auto Scan mode is the default (for QrScanMode) and the most versatile option available. It automatically combines machine learning detection with traditional scanning algorithms to deliver the best possible results across a range of image conditions.
The example shows an image being loaded and activating the Auto mode. It then scans the image and collects every QR code it finds into a list. Finally, it goes through the results collection and prints the text of each value within to the console (In this case, just the URL).
using System;
using IronQr;
using IronQr.Enum;
using IronSoftware.Drawing;
// Load the image file
var bmp = AnyBitmap.FromFile("cup.png");
// Create scan input using Auto Scan mode
var input = new QrImageInput(bmp, QrScanMode.Auto);
// Scan and read all QR codes
var results = new QrReader().Read(input);
// Initialize a counter to track the number of QR codes
int count = 1;
// Loop through each discovered QR code
foreach (var result in results)
{
Console.WriteLine($"QR {count}: {result.Value}");
count++;
}Imports System
Imports IronQr
Imports IronQr.Enum
Imports IronSoftware.Drawing
' Load the image file
Dim bmp = AnyBitmap.FromFile("cup.png")
' Create scan input using Auto Scan mode
Dim input = New QrImageInput(bmp, QrScanMode.Auto)
' Scan and read all QR codes
Dim results = New QrReader().Read(input)
' Initialize a counter to track the number of QR codes
Dim count As Integer = 1
' Loop through each discovered QR code
For Each result In results
Console.WriteLine($"QR {count}: {result.Value}")
count += 1
NextScan input

Console display
The URL of the cafe website gets logged after scanning the photo via IronQR.

Detection Model Mode
The Detection Model mode uses machine learning specifically for detecting QR code positions within images. This quality makes it invaluable for spatial analysis and computer vision applications. The coordinate system that it uses has the origin at (0, 0).
Generally, QR scanners make use of standard decoding algorithms which rely on three finder patterns, this model captures all four vertices of the ID. The result object contains a Points collection that you iterate through to retrieve the position data.
The code reuses the cup photo from the previous example to demonstrate the detection of positional values within the image.
using System;
using IronQr;
using IronQr.Enum;
using IronSoftware.Drawing;
using System.Linq;
// Load the image
var bmp = AnyBitmap.FromFile("cup.png");
// Create scan input using Detection Model mode
var input = new QrImageInput(bmp, QrScanMode.OnlyDetectionModel);
// Read QR code
var result = new QrReader().Read(input).FirstOrDefault();
// Print position data
if (result != null)
{
if (result.Points != null)
{
foreach (var point in result.Points)
{
Console.WriteLine($"Point: X={point.X}, Y={point.Y}");
}
}
}Imports System
Imports IronQr
Imports IronQr.Enum
Imports IronSoftware.Drawing
Imports System.Linq
' Load the image
Dim bmp = AnyBitmap.FromFile("cup.png")
' Create scan input using Detection Model mode
Dim input = New QrImageInput(bmp, QrScanMode.OnlyDetectionModel)
' Read QR code
Dim result = (New QrReader()).Read(input).FirstOrDefault()
' Print position data
If result IsNot Nothing Then
If result.Points IsNot Nothing Then
For Each point In result.Points
Console.WriteLine($"Point: X={point.X}, Y={point.Y}")
Next
End If
End IfLabelled cup image

Labelled console

Comparison of Scanning Methods
Feature (QrScanMode) | Basic Scan (OnlyBasicScan) | Auto Scan (Auto) | Detection Model (OnlyDetectionModel) |
|---|---|---|---|
| Output | Decoded Text (Value) | Decoded Text (Value) | Coordinates (Points) |
| Algorithm | Traditional Only | Hybrid (ML + Traditional) | Machine Learning Only |
| Focus | Speed | Readability / Retrieval | Localization / Computer Vision |
Conclusion
IronQR's three scanning modes provide flexibility for any QR code reading scenario:
- Auto Scan: Maximum accuracy and reliability for general use
- Basic Scan: Speed and efficiency for high-quality images
- Detection Model: Position awareness for spatial applications
By understanding the strengths of each method, you can optimize your QR code reading implementation for your specific requirements. Whether you need comprehensive data extraction, lightning-fast processing, or precise position detection, IronQR has you covered.
For more examples and detailed API information, visit the IronQR documentation or explore the code examples on GitHub.
Frequently Asked Questions
What are the different scanning modes available in IronQR for reading QR codes?
IronQR offers three scanning modes: Auto Scan, Only Basic Scan, and Detection Model. Auto Scan combines machine learning and traditional algorithms for precision, Only Basic Scan uses image processing for clarity and speed, and Detection Model employs machine learning to detect positions.
How does the Auto Scan mode work in IronQR?
Auto Scan mode in IronQR combines machine learning detection with basic scanning algorithms. It's the most versatile option, delivering optimal QR code reading results across various image conditions.
What is the purpose of the Only Basic Scan mode in IronQR?
The Only Basic Scan mode uses traditional image processing techniques to quickly and effectively scan QR codes, especially when they are clearly visible and well-positioned.
When should I use the Detection Model mode in IronQR?
Detection Model mode is ideal for spatial analysis and computer vision applications, as it uses machine learning to detect QR code positions and provides coordinate data for precise localization.
Can IronQR's Only Basic Scan mode read damaged QR codes?
Yes, IronQR's Only Basic Scan mode can read damaged QR codes, provided the three corner squares are clearly visible.
Why is the Auto Scan mode considered the default in IronQR?
The Auto Scan mode is considered the default in IronQR because it provides the highest reliability by combining machine learning and basic algorithms to handle a wide range of QR code scanning scenarios effectively.
What kind of output does each QrScanMode provide in IronQR?
The Auto and Only Basic Scan modes output the decoded text (Value), while the Detection Model provides coordinate data (Points) of detected QR code positions.
How can I read multiple QR codes from a single image using IronQR?
Using the Auto Scan mode, you can read multiple QR codes from a single image by scanning the image and iterating through the resulting list to access the text of each discovered QR code.
What makes Detection Model mode unique in its approach?
Detection Model mode exclusively uses machine learning to locate QR code positions, making it suitable for applications requiring detailed spatial data regarding QR code placement.

Ahmad is a full-stack developer with a strong foundation in C#, Python, and web technologies. He has a deep interest in building scalable software solutions and enjoys exploring how design and functionality meet in real-world applications.