// Import necessary IronQR and IronDrawing namespacesusing IronSoftware.Drawing; using IronBarcode;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); // Decode the QRコード from the image var result = BarcodeReader.Read(qrImageInput); // Iterate through each detected QRコード and display its information foreach (var barcodeResult in result.Barcodes) {Console.WriteLine($"QR Code Data: {barcodeResult.Value}"); } } }}
// Import necessary IronQR and IronDrawing namespaces
using IronSoftware.Drawing;
using IronBarcode;
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);
// Decode the QRコード from the image
var result = BarcodeReader.Read(qrImageInput);
// Iterate through each detected QRコード and display its information
foreach (var barcodeResult in result.Barcodes)
{
Console.WriteLine($"QR Code Data: {barcodeResult.Value}");
}
}
}
}
// Example: Reading QRコードs with enhanced error correctionusing IronBarcode;public class EnhancedQRReader{ public static voidReadPoorQualityImage() { // Configure reader with multiple attempts and error correction var options = new BarcodeReaderOptions {Speed = ReadingSpeed.Detailed, // More thorough scanningExpectMultipleBarcodes = true, // Check for multiple codesExpectBarcodeTypes = BarcodeType.QRCode// Focus on QRコードs only }; using (var inputImage = Image.FromFile("blurry_qr_code.jpg")) { var qrImageInput = new QrImageInput(inputImage); var results = BarcodeReader.Read(qrImageInput, options); foreach (var result in results.Barcodes) {Console.WriteLine($"Decoded: {result.Value}");Console.WriteLine($"Confidence: {result.Confidence}%"); } } }}
// Example: Reading QRコードs with enhanced error correction
using IronBarcode;
public class EnhancedQRReader
{
public static void ReadPoorQualityImage()
{
// Configure reader with multiple attempts and error correction
var options = new BarcodeReaderOptions
{
Speed = ReadingSpeed.Detailed, // More thorough scanning
ExpectMultipleBarcodes = true, // Check for multiple codes
ExpectBarcodeTypes = BarcodeType.QRCode // Focus on QRコードs only
};
using (var inputImage = Image.FromFile("blurry_qr_code.jpg"))
{
var qrImageInput = new QrImageInput(inputImage);
var results = BarcodeReader.Read(qrImageInput, options);
foreach (var result in results.Barcodes)
{
Console.WriteLine($"Decoded: {result.Value}");
Console.WriteLine($"Confidence: {result.Confidence}%");
}
}
}
}
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}")
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
作成と読み取りの両方で、複数の種類の QR コードがサポートされています。 IronQRは多様なアプリケーションのニーズに応えるため、様々なQRコードフォーマットを包括的にサポートしています。 サポートされているQRフォーマットの詳細については、当社のドキュメントを参照してください。 サポートされている QR コードの種類は次のとおりです。
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.