與其他組件的比較 IronBarcode與QrCoder C#的比較 Jordi Bardia 更新:2025年10月29日 下載 IronBarcode NuGet 下載 DLL 下載 開始免費試用 LLM副本 LLM副本 將頁面複製為 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"); } } $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"); } } $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"); } } $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); } } } } $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); } } } } $vbLabelText $csharpLabel IronBarcode讀取條碼後回傳 Enumerable。 我們需要循環遍歷它以獲取每個結果。 它有利於讀取包含多個條碼的文件或影像中的條碼。 上述程式碼產生的輸出如下: IronBarcode掃描PDF或影像中包含的條碼所需的時間 使用二維碼讀取條碼 QrCoder庫不提供讀取或掃描二維碼的功能。 現在,讓我們來討論一下這兩個函式庫的授權選項。 授權 IronBarcode的許可 IronBarcode可供開發免費使用。 但是,在 Visual Studio 開發環境之外部署則需要許可證。 許可證價格從 $liteLicense 到 $unlimitedLicense(美元)。 購買全套Iron Suite可享折扣。 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也提供全面的文件和全天候支持,而 QRCoder 則不提供。 IronBarcode會收取許可費,但考慮到它提供的功能和支持,這個費用是合理的。 IronBarcode是由Iron Software開發的函式庫,該公司還提供其他有用的函式庫,包括IronPDF 、 IronXL 、 IronOCR和IronWebScraper 。 購買全套Iron Suite產品,即可享有超值折扣,獲得全部五款產品。 總而言之, IronBarcode最適合需要同時處理條碼和二維碼,並希望建立條碼產生器、二維碼產生器、條碼閱讀器和二維碼閱讀器的人。 另一方面,QRCoder 適合只需要建立二維碼產生器的人。 請注意QrCoder 是其各自所有者的註冊商標。 本網站與 QrCoder 無任何關聯,也未獲得 QrCoder 的認可或贊助。 所有產品名稱、標誌和品牌均為其各自所有者的財產。 比較僅供參考,反映的是撰寫本文時可公開取得的資訊。 常見問題解答 如何在C#中生成QR碼? 要在C#中生成QR碼,您可以使用QrCoder庫,這是一個簡單且開源的庫。或者,您可以使用IronBarcode以獲得更高級的功能,例如樣式化QR碼並將其集成到文件中。 使用IronBarcode而非QrCoder的優勢是什麼? 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較快,大約需要592毫秒即可生成並存儲一個QR碼,而IronBarcode則需要約3503毫秒。然而,IronBarcode提供了比僅僅生成QR碼更多的進階功能。 IronBarcode需要許可證進行部署嗎? 是的,IronBarcode需要許可證才能在Visual Studio開發環境之外進行部署。它提供不同的許可方案,包括Lite、Professional和Unlimited套件。 IronBarcode為條形碼處理提供了哪些功能? IronBarcode允許讀取和寫入條形碼和QR碼、影像校正、樣式選項,以及將條形碼嵌入到PDF等文件中,使其成為條形碼處理的全面工具。 我應該選擇哪個庫用於在C#中生成簡單的QR碼? 對於簡單的QR碼生成,QrCoder是一個合適的選擇,因為它易於使用且免費授權。然而,對於更高級的任務,建議使用IronBarcode。 我可以使用C#將QR碼集成到PDF中嗎? 是的,您可以使用IronBarcode將QR碼嵌入到PDF中。它提供了讀取和寫入QR碼和條形碼以及將其無縫嵌入到文檔中的功能。 Jordi Bardia 立即與工程團隊聊天 軟體工程師 Jordi 在 Python、C# 和 C++ 上最得心應手,當他不在 Iron Software 展現技術時,便在做遊戲編程。在分担產品测测试,產品開發和研究的责任時,Jordi 為持续的產品改進增值。他说这种多样化的经验使他受到挑战并保持参与, 而这也是他与 Iron Software 中工作一大乐趣。Jordi 在佛罗里达州迈阿密长大,曾在佛罗里达大学学习计算机科学和统计学。 相關文章 更新2026年3月1日 Aspose BarCode for .NET示例對比IronBarcode:並排比較及代碼示例 Aspose.BarCode與IronBarcode進行C#代碼示例比較。涵蓋條碼生成, QR碼讀取, 價格, 及.NET平台支持對比。 閱讀更多 更新2026年1月19日 在.NET開發中應該使用哪個C#條碼程式庫? 在本指南中,我們將比較五個最廣泛使用的 .NET 條碼庫 — IronBarcode, http://ZXing.Net , Aspose.BarCode, BarcodeLib, 和 Dynamsoft Barcode Reader 閱讀更多 更新2025年7月28日 如何在ZXing中為C#開發人員掃描條碼 ZXing的模塊包括核心圖像解碼庫、JavaSE特定的客戶端代碼以及Android客戶端條碼掃描器。許多其他獨立的開源項目以此為基礎構建。 閱讀更多 ZXing.org QR碼庫和IronBarcode:全面的比較ZXing解碼器與IronBarcode的比較
更新2026年3月1日 Aspose BarCode for .NET示例對比IronBarcode:並排比較及代碼示例 Aspose.BarCode與IronBarcode進行C#代碼示例比較。涵蓋條碼生成, QR碼讀取, 價格, 及.NET平台支持對比。 閱讀更多
更新2026年1月19日 在.NET開發中應該使用哪個C#條碼程式庫? 在本指南中,我們將比較五個最廣泛使用的 .NET 條碼庫 — IronBarcode, http://ZXing.Net , Aspose.BarCode, BarcodeLib, 和 Dynamsoft Barcode Reader 閱讀更多
更新2025年7月28日 如何在ZXing中為C#開發人員掃描條碼 ZXing的模塊包括核心圖像解碼庫、JavaSE特定的客戶端代碼以及Android客戶端條碼掃描器。許多其他獨立的開源項目以此為基礎構建。 閱讀更多