使用 IRONQR QR Code Generator .NET Core:僅需幾行程式碼即可讀取並產生 QR 碼 Jordi Bardia 更新:2026年1月5日 下載 IronQR NuGet 下載 開始免費試用 法學碩士副本 法學碩士副本 將頁面複製為 Markdown 格式,用於 LLMs 在 ChatGPT 中打開 請向 ChatGPT 諮詢此頁面 在雙子座打開 請向 Gemini 詢問此頁面 在 Grok 中打開 向 Grok 詢問此頁面 打開困惑 向 Perplexity 詢問有關此頁面的信息 分享 在 Facebook 上分享 分享到 X(Twitter) 在 LinkedIn 上分享 複製連結 電子郵件文章 如果您在 .NET Core 上建立任何現代網路或企業解決方案,您會發現處理 QR 碼(用於庫存、付款或驗證)往往是核心需求。 您不想花時間與複雜的程式碼糾纏不清; 您需要一個快速、可靠且能正常運作的函式庫。 IronQR for .NET Core 提供了功能強大、多合一的 QR 碼產生器解決方案。 它可以管理從基本的 QR 創建到進階功能(如高錯誤修正和自訂影像)的一切,協助您加速開發。 準備好簡化您的 QR 代碼作業了嗎? 今天就開始免費試用,看看有多簡單。 !{--010011000100100101000010010100100100000101010010010110010101111101001110010101010101010101010101010101010101010 0100010111110100100101001101010100010000010100110001001100010111110100001001001100010011110010101010 如何安裝 QR Code Library? 透過 NuGet 套件管理員安裝 IronQR 是一項簡單的操作,只需幾秒鐘即可完成。 打開 Visual Studio,導覽到工具 > NuGet 套件管理員,然後搜尋 "IronQR"。按一下安裝按鈕,將 NuGet 套件新增至您的專案。 該函式庫對 NuGet 的依賴性極低,並支援 Windows、macOS 和 Linux 上的多平台專案。 Install-Package IronQR IronQR 與 .NET Core 6、7、8 和 9 以及 .NET Framework 4.6.2+ 相容。 對於多平台專案,SkiaSharp 整合可實現跨平台影像處理。 該函式庫支援 ASP.NET Core 網路應用程式、主控台應用程式和桌面解決方案,無須額外設定。 安裝完成後,原始碼會自動包含所有必要的 QR 作業擴充方法。 如何從圖片讀取基本 QR Code? 從 PNG 影像或其他格式讀取 QR code 資料只需要幾行程式碼。 QrReader 類使用先進的機器學習 QR 碼模型,可自動評估影像品質,並應用最佳區段模式偵測以進行精確的解碼。 using IronQr; using IronSoftware.Drawing; namespace Examples { class Program { static void Main(string[] args) { // Load image containing QR code var inputBmp = AnyBitmap.FromFile("qr-sample.png"); // Create QrImageInput from the bitmap QrImageInput imageInput = new QrImageInput(inputBmp); // Initialize QR Reader with ML model QrReader reader = new QrReader(); // Read and decode all QR codes in the image IEnumerable<QrResult> results = reader.Read(imageInput); // Output decoded text strings foreach (var qrCode in results) { Console.WriteLine($"QR Code Value: {qrCode.Value}"); Console.WriteLine($"URL: {qrCode.Url}"); } } } } using IronQr; using IronSoftware.Drawing; namespace Examples { class Program { static void Main(string[] args) { // Load image containing QR code var inputBmp = AnyBitmap.FromFile("qr-sample.png"); // Create QrImageInput from the bitmap QrImageInput imageInput = new QrImageInput(inputBmp); // Initialize QR Reader with ML model QrReader reader = new QrReader(); // Read and decode all QR codes in the image IEnumerable<QrResult> results = reader.Read(imageInput); // Output decoded text strings foreach (var qrCode in results) { Console.WriteLine($"QR Code Value: {qrCode.Value}"); Console.WriteLine($"URL: {qrCode.Url}"); } } } } Imports IronQr Imports IronSoftware.Drawing Namespace Examples Class Program Shared Sub Main(ByVal args As String()) ' Load image containing QR code Dim inputBmp = AnyBitmap.FromFile("qr-sample.png") ' Create QrImageInput from the bitmap Dim imageInput As New QrImageInput(inputBmp) ' Initialize QR Reader with ML model Dim reader As New QrReader() ' Read and decode all QR codes in the image Dim results As IEnumerable(Of QrResult) = reader.Read(imageInput) ' Output decoded text strings For Each qrCode In results Console.WriteLine($"QR Code Value: {qrCode.Value}") Console.WriteLine($"URL: {qrCode.Url}") Next End Sub End Class End Namespace $vbLabelText $csharpLabel 輸入二維碼 輸出 。 QrReader.Read() 方法處理來自 QR 符號的輸入文字,並傳回包含解碼資料的結果。 IronQR 支援編碼各種資料類型,包括 URL、電話號碼和文字串。 該函式庫可直接處理位元組陣列,或從延伸檔案路徑載入,因此可針對任何專案架構進行彈性整合。 如何擷取進階 QR Code 資料? 除了基本的 QR 代碼讀取之外,IronQR 還會從每個掃描代碼中揭露座標、原始模組和結構化資料片段。 這對於需要精確 QR 符號定位或同時處理多個代碼的應用程式來說是非常重要的。 using IronQr; using IronSoftware.Drawing; namespace Examples { class AdvancedReader { static void Main(string[] args) { var inputBmp = AnyBitmap.FromFile("document-with-qr.png"); QrImageInput imageInput = new QrImageInput(inputBmp); QrReader reader = new QrReader(); IEnumerable<QrResult> results = reader.Read(imageInput); foreach (var qrCode in results) { // Access QR code data and URL Console.WriteLine($"Data: {qrCode.Value}"); // Get coordinate positions (int x, int y) foreach (PointF point in qrCode.Points) { Console.WriteLine($"Position: {point.X}, {point.Y}"); } } } } } using IronQr; using IronSoftware.Drawing; namespace Examples { class AdvancedReader { static void Main(string[] args) { var inputBmp = AnyBitmap.FromFile("document-with-qr.png"); QrImageInput imageInput = new QrImageInput(inputBmp); QrReader reader = new QrReader(); IEnumerable<QrResult> results = reader.Read(imageInput); foreach (var qrCode in results) { // Access QR code data and URL Console.WriteLine($"Data: {qrCode.Value}"); // Get coordinate positions (int x, int y) foreach (PointF point in qrCode.Points) { Console.WriteLine($"Position: {point.X}, {point.Y}"); } } } } } Imports IronQr Imports IronSoftware.Drawing Namespace Examples Class AdvancedReader Shared Sub Main(args As String()) Dim inputBmp = AnyBitmap.FromFile("document-with-qr.png") Dim imageInput As New QrImageInput(inputBmp) Dim reader As New QrReader() Dim results As IEnumerable(Of QrResult) = reader.Read(imageInput) For Each qrCode In results ' Access QR code data and URL Console.WriteLine($"Data: {qrCode.Value}") ' Get coordinate positions (int x, int y) For Each point As PointF In qrCode.Points Console.WriteLine($"Position: {point.X}, {point.Y}") Next Next End Sub End Class End Namespace $vbLabelText $csharpLabel 輸入 QR 進階 QR 讀取結果 QrResult 物件提供對資料段、位置座標和解碼值的存取。 這樣就能實現覆疊生成、文件處理工作流程以及對佈局敏感的應用程式。 IronQR 可處理包含標誌、損壞代碼或低解析度輸入的自訂影像,這都歸功於其 ML 驅動的偵測功能。 錯誤修正等級如何影響 QR Code 讀取? 錯誤修正是 QR 代碼可靠性的基礎。 IronQR 支援所有標準錯誤修正等級 (L、M、Q、H),較高的等級可從損毀或模糊的程式碼中復原更多資料。 允許的最大版本號決定容量; 40 版 QR 碼最多可儲存 7,089 個數字字符。 在產生 QR 碼時,指定錯誤修正等級可確保輸出能承受實際世界的掃描條件: using IronQr; using IronSoftware.Drawing; // Configure QR options with high error correction var qrOptions = new QrOptions(QrErrorCorrectionLevel.High, 20); // Generate a QR code with specified error correction QrCode myQr = QrWriter.Write("https://ironsoftware.com", qrOptions); // Save as PNG image AnyBitmap qrImage = myQr.Save(); qrImage.SaveAs("high-error-correction-qr.png"); using IronQr; using IronSoftware.Drawing; // Configure QR options with high error correction var qrOptions = new QrOptions(QrErrorCorrectionLevel.High, 20); // Generate a QR code with specified error correction QrCode myQr = QrWriter.Write("https://ironsoftware.com", qrOptions); // Save as PNG image AnyBitmap qrImage = myQr.Save(); qrImage.SaveAs("high-error-correction-qr.png"); Imports IronQr Imports IronSoftware.Drawing ' Configure QR options with high error correction Dim qrOptions As New QrOptions(QrErrorCorrectionLevel.High, 20) ' Generate a QR code with specified error correction Dim myQr As QrCode = QrWriter.Write("https://ironsoftware.com", qrOptions) ' Save as PNG image Dim qrImage As AnyBitmap = myQr.Save() qrImage.SaveAs("high-error-correction-qr.png") $vbLabelText $csharpLabel 輸出 。 錯誤修正等級也會影響您是否可以在保持可掃描性的同時,加入 ECI 段落或標誌圖片。 較高的錯誤更正率可在不犧牲可靠性的情況下加入自訂顏色和品牌。 如何產生具有國際字符的 QR 碼? IronQR 支援透過漢字模式編碼日文 Unicode 文字的編碼方式,非常適合國際應用程式。 對於混合數字、字母數字或 Unicode 的內容,函式庫會自動選擇最佳的分割模式。 您也可以手動設定資料區段,或針對特定字元集新增 ECI 區段。 using IronQr; using IronSoftware.Drawing; // Generate QR that encodes Japanese Unicode text QrCode japaneseQr = QrWriter.Write("こんにちは世界"); // The library handles kanji mode automatically AnyBitmap qrImage = japaneseQr.Save(); qrImage.SaveAs("japanese-qr.png"); using IronQr; using IronSoftware.Drawing; // Generate QR that encodes Japanese Unicode text QrCode japaneseQr = QrWriter.Write("こんにちは世界"); // The library handles kanji mode automatically AnyBitmap qrImage = japaneseQr.Save(); qrImage.SaveAs("japanese-qr.png"); Imports IronQr Imports IronSoftware.Drawing ' Generate QR that encodes Japanese Unicode text Dim japaneseQr As QrCode = QrWriter.Write("こんにちは世界") ' The library handles kanji mode automatically Dim qrImage As AnyBitmap = japaneseQr.Save() qrImage.SaveAs("japanese-qr.png") $vbLabelText $csharpLabel QR 程式碼輸出 此自動編碼偵測功能可省去手動設定字元集的參數。 QR 代碼產生程序可無縫處理日文 Unicode 文字,支援完整的 Unicode 範圍,包括漢字模式字元。 如何使用 Payload 生成器生成結構化資料? IronQR 支援有效負載產生器,可針對 WiFi 認證、聯絡資訊和行事曆事件等常見使用個案,建立格式正確的 QR 碼資料。 這可簡化使用結構化資訊而非純文字來建立 QR 代碼的工作。 using IronQr; using IronSoftware.Drawing; // Generate QR code with URL payload var urlQrCode = QrWriter.Write("https://ironsoftware.com/csharp/qr/"); // Save QR as PNG image file AnyBitmap qrImage = urlQrCode.Save(); qrImage.SaveAs("url-qr-code.png"); Console.WriteLine("QR code generated successfully!"); using IronQr; using IronSoftware.Drawing; // Generate QR code with URL payload var urlQrCode = QrWriter.Write("https://ironsoftware.com/csharp/qr/"); // Save QR as PNG image file AnyBitmap qrImage = urlQrCode.Save(); qrImage.SaveAs("url-qr-code.png"); Console.WriteLine("QR code generated successfully!"); Imports IronQr Imports IronSoftware.Drawing ' Generate QR code with URL payload Dim urlQrCode = QrWriter.Write("https://ironsoftware.com/csharp/qr/") ' Save QR as PNG image file Dim qrImage As AnyBitmap = urlQrCode.Save() qrImage.SaveAs("url-qr-code.png") Console.WriteLine("QR code generated successfully!") $vbLabelText $csharpLabel 建立 QR 碼 代碼產生器可處理產生可設定尺寸的 PNG 影像。 QRCoder 函式庫提供類似 .NET 開放原始碼函式庫的功能,並擁有允許的 MIT 授權,不過 IronQR 提供增強的基於 ML 的閱讀功能和商業支援。 結論 IronQR 不只是用來閱讀完美的靜態影像; 當您需要在實際環境中掃描模糊或損壞的程式碼時,它就會發揮作用。 該函式庫支援可選的進階功能,例如遮罩模式配置、自訂樣式和國際字元編碼,因此適用於需要可靠性和彈性的企業應用程式。 從 產生 QR 碼到從各種影像格式讀取複雜的 QR 符號,IronQR 都能以最少的程式碼處理完整的工作流程。 直接的 API 文件和廣泛的 教學 有助於開發人員快速實作 QR 功能。 購買 IronQR 授權以解鎖生產部署的完整功能,或探索其他程式碼範例以觀看程式庫的運作。 常見問題解答 什麼是 IronQR? IronQR 是在 .NET Core 中處理 QR 碼的全面函式庫。它簡化了讀取和產生 QR 碼的過程,具有 ML-powered 檢測、高錯誤修正和跨平台支援等功能。 IronQR 對我的 .NET Core 專案有何幫助? IronQR 為您的 .NET Core 專案提供快速可靠的 QR 代碼產生與讀取解決方案,省去複雜編碼的麻煩。它可以管理從基本 QR 創建到進階功能的一切。 IronQR 有哪些進階功能? IronQR 包括一些進階功能,例如高錯誤修正等級、ML-powered 偵測,以及支援自訂影像,這些功能可大幅提升您應用程式的 QR code 功能。 IronQR 是否與跨平台開發相容? 是的,IronQR 的設計支援跨平台,非常適合以 .NET Core 為基礎的現代網路和企業解決方案。 IronQR 可以處理自訂的 QR 碼影像嗎? 絕對的,IronQR 允許在 QR 代碼中整合自訂圖片,為應用程式中的品牌與個人化提供彈性。 IronQR 如何改善 QR 碼的讀取過程? IronQR 透過 ML 驅動的偵測功能增強 QR 碼的讀取過程,即使在具挑戰性的條件下,也能確保準確且快速的掃描。 IronQR 是否支援 QR 碼的高錯誤修正? 是的,IronQR 支援高度錯誤修正,即使 QR 碼有部分損壞或模糊不清,也能正確掃描。 IronQR for .NET 是否容易整合到現有的 .NET Core 應用程式中? IronQR 的設計可輕鬆整合至任何 .NET Core 應用程式,提供無縫的使用經驗,無須大量重構即可新增 QR 碼功能。 Jordi Bardia 立即與工程團隊聊天 軟體工程師 Jordi 最精通的是 Python、C# 和 C++,當他在 Iron Software 沒有發揮他的技能時;他在進行遊戲程式設計。Jordi 分擔產品測試、產品開發和研究的責任,為產品的持續改善增添無限價值。多樣化的經驗讓他不斷接受挑戰並投入其中,他說這是他在 Iron Software 工作最喜歡的方面之一。Jordi 在佛羅里達州邁阿密長大,在佛羅里達大學主修電腦科學和統計學。 相關文章 更新2026年1月7日 QR Code Generator .NET Core:在 C# 中建立和讀取快速回應碼 QR 碼 .NET Core 教學:使用 C# 中的 IronQR 生成 QR 碼、配置纠错级别、添加徽标,并以 ML 供电的精度读取 QR 码。 閱讀更多 更新2026年1月7日 NuGet QR Code Generator:僅需幾行程式碼即可在 C# 中產生 QR 碼 安裝 NuGet QR 代碼套件,只需幾行文字即可在 C# 中產生 QR 代碼。支援跨平台 .NET、自訂樣式、PDF 嵌入以及 ML 驅動的讀取功能。 閱讀更多 更新2025年9月18日 如何在 C# 中從影像讀取 QR 在本指南中,我們將教您如何使用 IronQR(一個專為 .NET 建立的高效能 QR 碼函式庫,只需幾行 C# 程式碼即可從影像讀取 QR 碼)。 閱讀更多 NuGet QR Code Generator:僅需幾行程式碼即可在 C# 中產生 QR 碼如何在 C# 中從影像讀取 QR
更新2026年1月7日 QR Code Generator .NET Core:在 C# 中建立和讀取快速回應碼 QR 碼 .NET Core 教學:使用 C# 中的 IronQR 生成 QR 碼、配置纠错级别、添加徽标,并以 ML 供电的精度读取 QR 码。 閱讀更多
更新2026年1月7日 NuGet QR Code Generator:僅需幾行程式碼即可在 C# 中產生 QR 碼 安裝 NuGet QR 代碼套件,只需幾行文字即可在 C# 中產生 QR 代碼。支援跨平台 .NET、自訂樣式、PDF 嵌入以及 ML 驅動的讀取功能。 閱讀更多
更新2025年9月18日 如何在 C# 中從影像讀取 QR 在本指南中,我們將教您如何使用 IronQR(一個專為 .NET 建立的高效能 QR 碼函式庫,只需幾行 C# 程式碼即可從影像讀取 QR 碼)。 閱讀更多