與其他組件相比 IronBarcode 與 QrCoder C# 的比較 Curtis Chau 更新:2025年10月29日 下載 IronBarcode NuGet 下載 DLL 下載 開始免費試用 法學碩士副本 法學碩士副本 將頁面複製為 Markdown 格式,用於 LLMs 在 ChatGPT 中打開 請向 ChatGPT 諮詢此頁面 在雙子座打開 請向 Gemini 詢問此頁面 在 Grok 中打開 向 Grok 詢問此頁面 打開困惑 向 Perplexity 詢問有關此頁面的信息 分享 在 Facebook 上分享 分享到 X(Twitter) 在 LinkedIn 上分享 複製連結 電子郵件文章 在本教程中,我們將比較兩個廣泛使用的 C# 函式庫——IronBarcode 和 QrCoder——它們用於處理二維碼和條碼。 讓我們先簡單介紹一下這兩個函式庫: IronBarcode。 IronBarcode 是由 Iron Software 創建和維護的程式庫,它使 C# 軟體工程師能夠在 .NET 應用程式和網站中讀取和寫入條碼和二維碼。 它已在 NuGet 上發布,適用於所有 .NET Framework 和 .NET Core Framework。 IronBarcode 只需要一行程式碼即可讀取或寫入條碼。 QR 圖碼 QRCoder 是一個簡單的 C# 函式庫,可用來建立二維碼。 它不依賴其他程式庫,並且在 NuGet 上提供 .NET Framework 和 .NET Core PCL 版本。 這兩個庫都應該具備以下主要功能: 掃描二維碼 掃描條碼 產生二維碼 產生條碼 我們將實現這兩個庫中的所有功能,並比較它們的性能。 首先,讓我們在 Visual Studio 專案中安裝這兩個程式庫。 由於這兩個庫都有自己的 NuGet 套件,我們將透過 NuGet 套件管理器控制台安裝它們。 安裝 IronBarcode 若要安裝 IronBarcode,請在軟體套件管理器控制台中鍵入下列命令: Install-Package BarCode 這將在我們的專案中安裝 IronBarcode 庫。 安裝 IronBarcode 安裝二維碼 在軟體包管理器控制台中輸入以下命令: Install-Package QRCoder 這將在我們的專案中安裝 QrCoder 庫。 安裝二維碼器 現在,我們將使用這兩個庫來產生我們的第一個二維碼。 使用 IronBarcode 產生二維碼 以下程式碼將產生二維碼。 using System; using System.Diagnostics; using IronBarCode; class Program { static void Main() { // Create a stopwatch to measure the execution time Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); // Generate a QR code var qrCode = QRCodeWriter.CreateQrCode("Iron Barcode Vs QrCoder"); // Save the generated QR code as a PNG file qrCode.SaveAsPng(@"D:\Barcode Images\QrCodeByIronBarcode.png"); // Stop the stopwatch and output the execution time stopwatch.Stop(); Console.WriteLine($"Execution Time: {stopwatch.ElapsedMilliseconds} ms"); } } using System; using System.Diagnostics; using IronBarCode; class Program { static void Main() { // Create a stopwatch to measure the execution time Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); // Generate a QR code var qrCode = QRCodeWriter.CreateQrCode("Iron Barcode Vs QrCoder"); // Save the generated QR code as a PNG file qrCode.SaveAsPng(@"D:\Barcode Images\QrCodeByIronBarcode.png"); // Stop the stopwatch and output the execution time stopwatch.Stop(); Console.WriteLine($"Execution Time: {stopwatch.ElapsedMilliseconds} ms"); } } Imports System Imports System.Diagnostics Imports IronBarCode Friend Class Program Shared Sub Main() ' Create a stopwatch to measure the execution time Dim stopwatch As New Stopwatch() stopwatch.Start() ' Generate a QR code Dim qrCode = QRCodeWriter.CreateQrCode("Iron Barcode Vs QrCoder") ' Save the generated QR code as a PNG file qrCode.SaveAsPng("D:\Barcode Images\QrCodeByIronBarcode.png") ' Stop the stopwatch and output the execution time stopwatch.Stop() Console.WriteLine($"Execution Time: {stopwatch.ElapsedMilliseconds} ms") End Sub End Class $vbLabelText $csharpLabel 建立Stopwatch實例是為了測量程式的執行時間,從而分析函式庫的效率。 由 IronBarcode 產生的條碼 IronBarcode。 的執行時間 IronBarcode 產生並儲存二維碼需要 3503 毫秒。 IronBarcode產生新條碼的執行時間 使用 QRCoder 建立二維碼 以下範例程式碼將使用 QrCoder 產生二維碼。 using System; using System.Drawing; using QRCoder; class Program { static void Main() { // Initialize the QRCodeGenerator QRCodeGenerator qrGenerator = new QRCodeGenerator(); // Generate QRCodeData with specified error correction level QRCodeData qrCodeData = qrGenerator.CreateQrCode("Iron Barcode Vs QrCoder", QRCodeGenerator.ECCLevel.Q); // Create QRCode object QRCode qrCode = new QRCode(qrCodeData); // Convert QRCode to Bitmap Bitmap qrCodeImage = qrCode.GetGraphic(20); // Save the QR code as a PNG file qrCodeImage.Save(@"D:\Barcode Images\QrCodeByQrCoder.png"); } } using System; using System.Drawing; using QRCoder; class Program { static void Main() { // Initialize the QRCodeGenerator QRCodeGenerator qrGenerator = new QRCodeGenerator(); // Generate QRCodeData with specified error correction level QRCodeData qrCodeData = qrGenerator.CreateQrCode("Iron Barcode Vs QrCoder", QRCodeGenerator.ECCLevel.Q); // Create QRCode object QRCode qrCode = new QRCode(qrCodeData); // Convert QRCode to Bitmap Bitmap qrCodeImage = qrCode.GetGraphic(20); // Save the QR code as a PNG file qrCodeImage.Save(@"D:\Barcode Images\QrCodeByQrCoder.png"); } } Imports System Imports System.Drawing Imports QRCoder Friend Class Program Shared Sub Main() ' Initialize the QRCodeGenerator Dim qrGenerator As New QRCodeGenerator() ' Generate QRCodeData with specified error correction level Dim qrCodeData As QRCodeData = qrGenerator.CreateQrCode("Iron Barcode Vs QrCoder", QRCodeGenerator.ECCLevel.Q) ' Create QRCode object Dim qrCode As New QRCode(qrCodeData) ' Convert QRCode to Bitmap Dim qrCodeImage As Bitmap = qrCode.GetGraphic(20) ' Save the QR code as a PNG file qrCodeImage.Save("D:\Barcode Images\QrCodeByQrCoder.png") End Sub End Class $vbLabelText $csharpLabel QrCoder 沒有提供將二維碼儲存為影像的內建功能。 但是,我們可以透過將 QrCoder 解析為 Bitmap 物件來保存它。 然後我們可以使用 Bitmap 提供的保存功能來保存二維碼。 QrCoder 產生的條碼 QR 圖碼的執行時間 QrCoder 產生並儲存二維碼需要 592 毫秒。 QrCoder 產生新條碼所需的時間 分析 IronBarcode 的執行時間為 3503 毫秒,而 QrCoder 僅需 592 毫秒。 這使得 QrCoder 在性能方面比 IronBarcode 更快。 在 IronBarcode 中產生二維碼要簡單得多,因為我們只需要編寫兩行程式碼。 使用 QrCoder 庫,只需五行程式碼。 IronBarcode 還提供了一個內建功能,可以將產生的二維碼儲存到檔案中,而 QrCoder 則沒有。 我們需要建立一個點陣圖對象,以便將二維碼保存到檔案中。這需要我們建立四個對象,才能使用 QrCoder 產生二維碼。 我們只需要在 IronBarcode 中建立一個物件就能實現相同的功能。 接下來,我們將使用這兩個函式庫來產生條碼。 使用 IronBarcode 產生條碼 以下程式碼將使用 IronBarcode 產生條碼: using IronBarCode; class Program { static void Main() { // Generate a barcode with Code128 encoding var barcode = BarcodeWriter.CreateBarcode("Iron Barcode Vs QrCoder", BarcodeEncoding.Code128); // Save the generated barcode as a PNG file barcode.SaveAsPng(@"D:\Barcode Images\BarcodeByIronBarcode.png"); } } using IronBarCode; class Program { static void Main() { // Generate a barcode with Code128 encoding var barcode = BarcodeWriter.CreateBarcode("Iron Barcode Vs QrCoder", BarcodeEncoding.Code128); // Save the generated barcode as a PNG file barcode.SaveAsPng(@"D:\Barcode Images\BarcodeByIronBarcode.png"); } } Imports IronBarCode Friend Class Program Shared Sub Main() ' Generate a barcode with Code128 encoding Dim barcode = BarcodeWriter.CreateBarcode("Iron Barcode Vs QrCoder", BarcodeEncoding.Code128) ' Save the generated barcode as a PNG file barcode.SaveAsPng("D:\Barcode Images\BarcodeByIronBarcode.png") End Sub End Class $vbLabelText $csharpLabel 使用 IronBarcode 產生條碼 使用 IronBarcode 產生條碼所需的執行時間如下: IronBarcode的條碼產生時間 產生一個條碼需要 3756 毫秒或 3.76 秒。 使用二維碼產生條碼 值得注意的是,QrCoder 函式庫不提供建立條碼的功能。 因此,如果您需要建立條碼,IronBarcode 是更好的選擇。 關於二維碼掃描,讓我們來看看哪個函式庫是最佳選擇。 使用 IronBarcode 讀取二維碼 以下程式碼將使用 IronBarcode 讀取二維碼。 using System; using IronBarCode; class Program { static void Main() { // Read QR code from an image file BarcodeResults results = BarcodeReader.Read(@"D:\Barcode Images\QrcodeByIronBarcode.png"); // Check if any QR codes are found if (results != null) { // Loop through each result and print extracted text foreach (BarcodeResult result in results) { Console.WriteLine("Extracted text from QR Code is: " + result.Text); } } } } using System; using IronBarCode; class Program { static void Main() { // Read QR code from an image file BarcodeResults results = BarcodeReader.Read(@"D:\Barcode Images\QrcodeByIronBarcode.png"); // Check if any QR codes are found if (results != null) { // Loop through each result and print extracted text foreach (BarcodeResult result in results) { Console.WriteLine("Extracted text from QR Code is: " + result.Text); } } } } Imports System Imports IronBarCode Friend Class Program Shared Sub Main() ' Read QR code from an image file Dim results As BarcodeResults = BarcodeReader.Read("D:\Barcode Images\QrcodeByIronBarcode.png") ' Check if any QR codes are found If results IsNot Nothing Then ' Loop through each result and print extracted text For Each result As BarcodeResult In results Console.WriteLine("Extracted text from QR Code is: " & result.Text) Next result End If End Sub End Class $vbLabelText $csharpLabel IronBarcode 讀取二維碼後會回傳一個Enumerable 。 我們需要遍歷Enumerable來檢索每個結果。 此功能有利於從文件或包含多個二維碼的影像中讀取二維碼。 IronBarcode讀取/掃描文件中所有二維碼所需的時間 使用 IronBarcode 需要 3136 毫秒或 3.1 秒。 使用 QrCoder 讀取二維碼 QrCoder 函式庫不提供讀取或掃描二維碼的功能。 使用 IronBarcode 讀取條碼 以下程式碼將使用 IronBarcode 掃描條碼。 using System; using IronBarCode; class Program { static void Main() { // Read barcode from an image file BarcodeResults results = BarcodeReader.Read(@"D:\Barcode Images\BarcodeByIronBarcode.png"); // Check if any barcodes are found if (results != null) { // Loop through each result and print extracted text foreach (BarcodeResult result in results) { Console.WriteLine("Text Extracted from Barcode is: " + result.Text); } } } } using System; using IronBarCode; class Program { static void Main() { // Read barcode from an image file BarcodeResults results = BarcodeReader.Read(@"D:\Barcode Images\BarcodeByIronBarcode.png"); // Check if any barcodes are found if (results != null) { // Loop through each result and print extracted text foreach (BarcodeResult result in results) { Console.WriteLine("Text Extracted from Barcode is: " + result.Text); } } } } Imports System Imports IronBarCode Friend Class Program Shared Sub Main() ' Read barcode from an image file Dim results As BarcodeResults = BarcodeReader.Read("D:\Barcode Images\BarcodeByIronBarcode.png") ' Check if any barcodes are found If results IsNot Nothing Then ' Loop through each result and print extracted text For Each result As BarcodeResult In results Console.WriteLine("Text Extracted from Barcode is: " & result.Text) Next result End If End Sub End Class $vbLabelText $csharpLabel IronBarcode 讀取條碼後回傳Enumerable 。 我們需要循環遍歷它以獲取每個結果。 它有利於讀取包含多個條碼的文件或影像中的條碼。 上述程式碼產生的輸出如下: IronBarcode掃描PDF或影像中包含的條碼所需的時間 使用二維碼讀取條碼 QrCoder庫不提供讀取或掃描二維碼的功能。 現在,讓我們來討論一下這兩個函式庫的授權選項。 授權 IronBarcode。 的許可 IronBarcode 可供開發免費使用。 但是,要在 Visual Studio 開發環境之外部署,則需要許可證。 許可證價格從 $liteLicense 到 $unlimitedLicense(美元)。 購買全套鐵人套裝可享折扣。 Check out IronBarcode's [licensing page](/csharp/barcode/licensing/) for more information about available licenses. QR 圖碼 的許可 QrCoder是開源軟體,因此不需要任何授權。 您可以在任何類型的環境下自由使用它。 如果你喜歡開源開發,也可以為它的原始碼做出貢獻。 何時使用二維碼 如果我們只需要產生二維碼的功能,QRCoder 是最佳選擇,因為它免費使用,不需要任何付款或訂閱費用。 何時使用 IronBarcode IronBarcode 在我們需要產生二維碼以外的其他功能時是一個很好的選擇,例如: 從影像或 PDF 讀取單一或多個條碼和二維碼。 針對傾斜、方向、雜訊、低解析度、對比等進行影像修正。 建立條碼並將其套用至影像或 PDF 文件。 將條碼嵌入 HTML 文件中。 條碼樣式設定和新增註釋文字。 可編寫二維碼,並可新增徽標、顏色和進階二維碼對齊功能。 摘要 下表對 IronBarcode 和 QrCoder 進行了比較。 IronBarcode 和 QrCoder 的並排比較 結論 IronBarcode for .NET 允許開發人員使用一行程式碼在其 .NET 應用程式中讀取和寫入條碼和二維碼。 該庫支援大多數條碼和二維碼標準,包括 39/93/128、UPC A/E、EAN 8/13 和 QR 等。 此庫可自動預處理條碼影像,並提供旋轉、雜訊、失真和傾斜校正,以提高速度和準確性。 IronBarcode 與 32 位元和 64 位元系統、所有 .NET 語言以及各種平台相容,包括桌面、控制台、雲端、行動裝置和 Web 應用程式。 它還允許開發人員為 PDF、JPG、TIFF、GIF、BMP、PNG 和 HTML 文件編寫條碼和二維碼,並修改文字顏色、大小、旋轉和品質。 圖書館安全可靠,不使用網路服務,也不透過網路傳送資料。 IronBarcode 提供免費試用版,並提供三種授權選項,包括供個人使用的 Lite 版本、最多 10 名開發人員團隊使用的專業版套餐以及供公司使用的無限版套餐。 QRCoder 是一個 C# .NET 函式庫,它根據 ISO/IEC 18004 產生二維碼,不依賴其他函式庫。 它提供多種二維碼渲染類,包括 QRCode、ArtQRCode、AsciiQRCode 等。 但是,並非所有渲染器都適用於所有目標框架,.NET Standard/.NET >=5.0 版本有一些限制。 QRCoder是免費的,無需許可證。 IronBarcode 比 QrCoder 功能更全面,因為它支援所有 .NET Framework 版本,具有更廣泛的功能,並提供 SaaS 和 OEM 再分發服務。 IronBarcode 還提供全面的文件和 24/7 全天候支持,而 QRCoder 則不提供。 IronBarcode 會收取許可費,但考慮到它提供的功能和支持,這個費用是合理的。 IronBarcode 是由Iron Software開發的函式庫,該公司還提供其他有用的函式庫,包括IronPDF 、 IronXL 、 IronOCR和IronWebScraper 。 購買全套Iron Suite產品,即可享有超值折扣,獲得全部五款產品。 總而言之,IronBarcode 最適合需要同時處理條碼和二維碼,並希望建立條碼產生器、二維碼產生器、條碼閱讀器和二維碼閱讀器的人。 另一方面,QRCoder 適合只需要建立二維碼產生器的人。 請注意QrCoder 是其各自所有者的註冊商標。 本網站與 QrCoder 無任何關聯,也未獲得 QrCoder 的認可或贊助。 所有產品名稱、標誌和品牌均為其各自擁有者的財產。 比較資料僅供參考,並反映撰寫時的公開資訊。 常見問題解答 如何在C#中產生二維碼? 要在 C# 中產生二維碼,可以使用 QrCoder 函式庫,這是一個簡單易用的開源函式庫。或者,您也可以使用 IronBarcode,它提供更高級的功能,例如二維碼樣式設定並將其整合到文件中。 與 QrCoder 相比,使用 IronBarcode 有哪些優點? IronBarcode 提供豐富的功能,例如讀取條碼和二維碼、影像校正以及將條碼嵌入 PDF 和其他文件。它是需要進行全面條碼和二維碼操作的項目的理想選擇。 有沒有免費的 C# 二維碼產生庫? 是的,QrCoder 是一個免費開源的 C# 二維碼產生函式庫。它不需要許可證,因此對於簡單的二維碼生成來說,它是一個經濟實惠的選擇。 我可以用QrCoder讀取二維碼嗎? 不,QrCoder 不支援讀取或掃描二維碼。要讀取二維碼,您可以使用 IronBarcode,它不僅提供此功能,還提供其他一些功能。 如何在.NET專案中安裝二維碼庫? 您可以使用 NuGet 套件管理員控制台,透過指令Install-Package QRCoder安裝 QrCoder。對於 IronBarcode,請使用Install-Package IronBarcode 。 IronBarcode 和 QrCoder 在產生二維碼方面的執行時間差異是多少? QrCoder 速度更快,產生並保存一個二維碼大約需要 592 毫秒,而 IronBarcode 則需要大約 3503 毫秒。不過,IronBarcode 除了產生二維碼之外,還提供更多進階功能。 IronBarcode部署需要授權嗎? 是的,IronBarcode 需要在 Visual Studio 開發環境之外部署才能使用,因此需要許可證。它提供不同的許可選項,包括 Lite、Professional 和 Unlimited 套餐。 IronBarcode 提供哪些條碼處理功能? IronBarcode 可以讀取和寫入條碼和二維碼,進行影像校正,提供樣式選項,並能將條碼嵌入到 PDF 等文件中,使其成為一款全面的條碼處理工具。 在C#中,我應該選擇哪個函式庫來產生簡單的二維碼? 對於簡單的二維碼生成,QrCoder 因其易用性和免費許可而是一個不錯的選擇。但是,對於更高階的任務,我們推薦使用 IronBarcode。 我可以使用 C# 將二維碼整合到 PDF 中嗎? 是的,您可以使用 IronBarcode 將二維碼整合到 PDF 文件中。它提供讀取和寫入二維碼和條碼的功能,並能將它們無縫嵌入到文件中。 Curtis Chau 立即與工程團隊聊天 技術撰稿人 Curtis Chau 擁有電腦科學學士學位(卡爾頓大學),專長於前端開發,精通 Node.js、TypeScript、JavaScript 和 React。Curtis 對製作直覺且美觀的使用者介面充滿熱情,他喜歡使用現代化的架構,並製作結構良好且視覺上吸引人的手冊。除了開發之外,Curtis 對物聯網 (IoT) 也有濃厚的興趣,他喜歡探索整合硬體與軟體的創新方式。在空閒時間,他喜歡玩遊戲和建立 Discord bots,將他對技術的熱愛與創意結合。 相關文章 更新2025年11月16日 在 .NET 開發中,應該使用哪個 C# 條碼函式庫? 在本指南中,我們將比較五種最常使用的 .NET 條碼庫-IronBarcode、http://ZXing.Net、Aspose.BarCode、BarcodeLib 和 Dynamsoft Barcode Reader。 閱讀更多 更新2025年7月28日 如何在 ZXing 中掃描條碼(面向 C# 開發人員) ZXing 由眾多模組組成,其中包括核心圖像解碼庫、JavaSE 專用客戶端程式碼以及 Android 用戶端條碼掃描器。此外,還有許多基於 ZXing 建置的獨立開源專案。 閱讀更多 更新2025年8月31日 ZXing.org 二維碼庫與 IronBarcode:全面比較 ZXing 是一個流行的開源庫,用於產生和解碼一維和二維條碼。 閱讀更多 ZXing.org 二維碼庫與 IronBarcode:全面比較ZXing解碼器與IronBarcode解碼...
更新2025年11月16日 在 .NET 開發中,應該使用哪個 C# 條碼函式庫? 在本指南中,我們將比較五種最常使用的 .NET 條碼庫-IronBarcode、http://ZXing.Net、Aspose.BarCode、BarcodeLib 和 Dynamsoft Barcode Reader。 閱讀更多
更新2025年7月28日 如何在 ZXing 中掃描條碼(面向 C# 開發人員) ZXing 由眾多模組組成,其中包括核心圖像解碼庫、JavaSE 專用客戶端程式碼以及 Android 用戶端條碼掃描器。此外,還有許多基於 ZXing 建置的獨立開源專案。 閱讀更多