IRONSOFTWAREHOME
读取QR码值
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}");
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}")
NuGet Download
PM > Install-Package IronQR
读取QR码值

读取QR码值

可轻松将二维码内容提取为可直接使用的字符串,从而让您立即向用户显示该值、将其保存到数据库,或传递给其他函数。 IronQR 使用 QrReader.Read() 从任何图像中读取嵌入数据,并通过每个 QrResult 上的 Value 属性公开这些数据。

读取二维码值的 5 步指南

  • using IronQr;
  • QrImageInput imageInput = new QrImageInput(Image.FromFile("sample.jpg"));
  • QrReader reader = new QrReader();
  • IEnumerable<QrResult> results = reader.Read(imageInput);
  • Console.WriteLine(results.First().Value);

代码解释

一个包含QR码的图像从磁盘加载,并包装在一个 QrImageInput 对象中,告知IronQR需要扫描的内容。 一个 QrReader 实例处理输入并返回一组 QrResult 对象,每个QR码在图像中都会有一个对象。 在结果上调用 .Value 可以直接获得解码后的字符串,无论是URL、产品ID还是其他编码文本。

了解如何使用 IronQR 读取二维码值。

准备开始了吗?

Nuget Downloads 74,386版本:2026.9刚刚发布

Key in blue circle

立即获取免费的 30 天试用版密钥

Your trial license will be sent to your email address

无任何限制。100% 解锁。无需信用卡。

bullet_checked无需信用卡或创建账户无任何限制。100% 解锁。无需信用卡。
  • Logo Aetna
  • Logo NASA
  • Logo GE
  • Logo Porsche
  • Logo USDA
  • Logo Qatar
Join Millions of Engineers who’ve tried IronPDF
预约您的免费现场演示
Booking Badge

深受全球数百万工程师信赖

Iron Software 的客户徽标
获取您的无义务咨询
填写下面的表格或通过sales@ironsoftware.com
您的资料将始终保密。
深受全球数百万工程师信赖
Iron Software 的客户徽标
立即获取您的免费30 天试用密钥
无需信用卡或创建账户