using IronQr;
using IronSoftware.Drawing;
using Microsoft.Win32;
// Open a file dialog to select a QR code image
var dialog = new OpenFileDialog
{
Title = "Select a QR code image",
Filter = "Image Files|*.png;*.jpg;*.jpeg;*.bmp;*.gif;*.tiff"
};
if (dialog.ShowDialog() == true)
{
// Load the selected image into IronQR
var inputBmp = AnyBitmap.FromFile(dialog.FileName);
QrImageInput imageInput = new QrImageInput(inputBmp);
// Create a QR Reader object and read the image
QrReader reader = new QrReader();
IEnumerable<QrResult> results = reader.Read(imageInput);
// Display the first result
ResultLabel.Text = results.FirstOrDefault()?.Value ?? "No QR code found.";
}
Imports IronQr
Imports IronSoftware.Drawing
Imports Microsoft.Win32
' Open a file dialog to select a QR code image
Dim dialog As New OpenFileDialog With {
.Title = "Select a QR code image",
.Filter = "Image Files|*.png;*.jpg;*.jpeg;*.bmp;*.gif;*.tiff"
}
If dialog.ShowDialog() = True Then
' Load the selected image into IronQR
Dim inputBmp = AnyBitmap.FromFile(dialog.FileName)
Dim imageInput As New QrImageInput(inputBmp)
' Create a QR Reader object and read the image
Dim reader As New QrReader()
Dim results As IEnumerable(Of QrResult) = reader.Read(imageInput)
' Display the first result
ResultLabel.Text = If(results.FirstOrDefault()?.Value, "No QR code found.")
End If