與其他組件的比較 IronBarcode與QrCoder C#的比較 Jordi Bardia 更新:7月 28, 2025 下載 IronBarcode NuGet 下載 DLL 下載 開始免費試用 法學碩士副本 法學碩士副本 將頁面複製為 Markdown 格式,用於 LLMs 在 ChatGPT 中打開 請向 ChatGPT 諮詢此頁面 在雙子座打開 請向 Gemini 詢問此頁面 在雙子座打開 請向 Gemini 詢問此頁面 打開困惑 向 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# 中產生 QR 碼? 若要在 C# 中產生 QR 碼,您可以使用 QrCoder 函式庫,這是一個簡單且開放原始碼的函式庫。另外,您也可以使用 IronBarcode 來取得更進階的功能,例如 QR 碼的樣式設計以及將 QR 碼整合到文件中。 與 QrCoder 相比,使用 IronBarcode 有哪些優勢? IronBarcode 提供廣泛的功能,例如讀取條碼和 QR 代碼、影像修正,以及將條碼嵌入 PDF 和其他文件。它是需要全面條碼和 QR 代碼操作的專案的理想選擇。 有沒有用 C# 產生 QR 碼的免費程式庫? 是的,QrCoder 是用 C# 產生 QR 碼的免費開放原始碼程式庫。它不需要授權,是簡單 QR 代碼產生的高性價比選擇。 我可以使用 QrCoder 讀取 QR 碼嗎? 不,QrCoder 不支援讀取或掃描 QR 碼。若要讀取 QR 代碼,您可以使用 IronBarcode,它提供此功能以及其他功能。 如何在 .NET 專案中安裝 QR 代碼庫? 您可以透過 NuGet 套件管理員控制台,使用 Install-Package QRCoder 指令來安裝 QrCoder。對於 IronBarcode,請使用 Install-Package IronBarcode。 IronBarcode 和 QrCoder 生成 QR 代碼的執行時間差是多少? QrCoder 的速度較快,產生並儲存 QR 代碼約需 592 毫秒,而 IronBarcode 則約需 3503 毫秒。然而,IronBarcode 除了提供 QR 代碼產生之外,還提供更多的進階功能。 部署 IronBarcode 需要許可證嗎? 是的,IronBarcode 需要授權才能在 Visual Studio 開發環境之外部署。它提供不同的 License 選項,包括 Lite、Professional 和 Unlimited 套件。 IronBarcode 為條碼處理提供哪些功能? IronBarcode 可以讀寫條碼和 QR 代碼、圖像校正、樣式選項,並能夠將條碼嵌入 PDF 等文件中,是一款全面的條碼處理工具。 在 C# 中生成簡單的 QR 碼應該選擇哪個庫? 對於簡單的 QR 代碼生成,QrCoder 因其易用性和免費授權而成為合適的選擇。不過,若要執行更進階的任務,建議使用 IronBarcode。 我可以使用 C# 將 QR 碼整合到 PDF 中嗎? 是的,您可以使用 IronBarcode 將 QR 代碼整合到 PDF 中。它提供讀寫 QR 碼和 BarCode 的功能,並將它們無縫嵌入到文件中。 Jordi Bardia 立即與工程團隊聊天 軟體工程師 Jordi 在 Python、C# 和 C++ 上最得心應手,當他不在 Iron Software 展現技術時,便在做遊戲編程。在分担产品测测试,产品开发和研究的责任时,Jordi 为持续的产品改进增值。他说这种多样化的经验使他受到挑战并保持参与, 而这也是他与 Iron Software 中工作一大乐趣。Jordi 在佛罗里达州迈阿密长大,曾在佛罗里达大学学习计算机科学和统计学。 相關文章 更新9月 25, 2025 如何在C#中選擇最佳條碼庫 在本指南中,我們將比較五個最廣泛使用的 .NET 條碼庫 — IronBarcode, http://ZXing.Net , Aspose.BarCode, BarcodeLib, 和 Dynamsoft Barcode Reader 閱讀更多 更新7月 28, 2025 如何在ZXing中為C#開發人員掃描條碼 ZXing的模塊包括核心圖像解碼庫、JavaSE特定的客戶端代碼以及Android客戶端條碼掃描器。許多其他獨立的開源項目以此為基礎構建。 閱讀更多 更新8月 31, 2025 ZXing.org QR碼庫和IronBarcode:全面的比較 ZXing是一個流行的開源庫,用於生成和解碼一維和二維條碼。 閱讀更多 ZXing.org QR碼庫和IronBarcode:全面的比較ZXing解碼器與IronBarcode的比較
更新9月 25, 2025 如何在C#中選擇最佳條碼庫 在本指南中,我們將比較五個最廣泛使用的 .NET 條碼庫 — IronBarcode, http://ZXing.Net , Aspose.BarCode, BarcodeLib, 和 Dynamsoft Barcode Reader 閱讀更多
更新7月 28, 2025 如何在ZXing中為C#開發人員掃描條碼 ZXing的模塊包括核心圖像解碼庫、JavaSE特定的客戶端代碼以及Android客戶端條碼掃描器。許多其他獨立的開源項目以此為基礎構建。 閱讀更多