跳過到頁腳內容
與其他組件的比較

ZXing.org QR碼庫和IronBarcode:全面的比較

如果您已經有了技術電話/管理電話中的條碼電子圖像,並且想要將其解讀為英文文字數據,那麼條碼掃描器可能不是最佳工具。 此外,條碼掃描器僅限於讀取一維條碼,其儲存容量、網域狀態、支援的格式均受到限制,並且只能與 Windows RT 類別庫一起使用。 如今,二維條碼(也稱為二維碼)更加常見,並且可以儲存更多信息,例如更新日期。

條碼掃描應用程式可以在 Windows、MacOS 或 Linux 上運行,無需依賴任何第三方工具或 API,因為它由 .NET 支援。

ZXing.org 二維碼庫和 IronBarcode:全面比較:圖 2 - Web 應用程式

創建和掃描條碼已成為許多企業避免垃圾郵件的必要手段。 創建條碼的兩個常用工具是開源的 ZXing 專案 decode 和IronBarcode 。 在本文中,我們將探討這些工具各自的特點和優勢,並對它們進行比較。

ZXing解碼器

ZXing是一個流行的開源庫,用於生成和解碼一維和二維條碼。

它還支援多種程式語言,包括 Java、C++ 和 .NET。

ZXing Decoder Online 是一款基於網路的工具,使用戶能夠掃描和解碼條碼和二維碼影像。 此外,使用者可以為任何資訊建立二維碼,這些資訊通常以 URL 或他們想要編碼的文字的形式存在。

若要使用ZXing線上解碼器,請依照下列步驟操作:

  1. 造訪 ZXing 解碼器線上網站。

    ZXing.org 二維碼庫與 IronBarcode:全面比較:圖 2 - ZXing Web 由 Google 開發

  2. 點選"選擇檔案"按鈕,選擇二維碼圖片檔。
  3. 選擇圖片後,點選"提交"按鈕。

    ZXing.org 二維碼庫與 IronBarcode:全面比較:圖 3 - ZXing 解碼

  4. 如果找到可識別的代碼,該工具將解碼二維碼並顯示結果資訊。

該庫易於使用,可以整合到 Web 應用程式、行動應用程式和桌面應用程式中。

ZXing 已被廣泛採用,並擁有龐大的開發者社區,他們為 ZXing 的開發做出貢獻並提供支援。

該庫會收集設備信息,例如設備型號和操作系統版本,這可能被視為潛在的安全風險。

此外,有些人對圖書館的所有權和控制權表示擔憂,因為它並非由獨立組織維護。

總的來說,ZXing 是一個功能強大且用途廣泛的條碼生成和解碼庫,得到了廣泛的應用和社群支援。

例如,要使用 ZXing 產生二維碼,開發人員只需要編寫幾行程式碼:

using ZXing;
using ZXing.QrCode;

// Create a BarcodeWriter instance to generate QR codes
BarcodeWriter writer = new BarcodeWriter
{
    Format = BarcodeFormat.QR_CODE // Set format to QR_CODE
};

// Generate a QR code with the text "Hello, ZXing!"
Bitmap qrCode = writer.Write("Hello, ZXing!");
using ZXing;
using ZXing.QrCode;

// Create a BarcodeWriter instance to generate QR codes
BarcodeWriter writer = new BarcodeWriter
{
    Format = BarcodeFormat.QR_CODE // Set format to QR_CODE
};

// Generate a QR code with the text "Hello, ZXing!"
Bitmap qrCode = writer.Write("Hello, ZXing!");
Imports ZXing
Imports ZXing.QrCode

' Create a BarcodeWriter instance to generate QR codes
Private writer As New BarcodeWriter With {.Format = BarcodeFormat.QR_CODE}

' Generate a QR code with the text "Hello, ZXing!"
Private qrCode As Bitmap = writer.Write("Hello, ZXing!")
$vbLabelText   $csharpLabel

若要使用 ZXing 專案解碼二維碼,開發者可以使用以下程式碼:

using ZXing;
using ZXing.QrCode;

// Create a BarcodeReader instance for decoding QR codes
BarcodeReader reader = new BarcodeReader();

// Decode the QR code from a bitmap image
Result result = reader.Decode(qrCode);

// Extract the text from the decoded QR code
string text = result.Text;
using ZXing;
using ZXing.QrCode;

// Create a BarcodeReader instance for decoding QR codes
BarcodeReader reader = new BarcodeReader();

// Decode the QR code from a bitmap image
Result result = reader.Decode(qrCode);

// Extract the text from the decoded QR code
string text = result.Text;
Imports ZXing
Imports ZXing.QrCode

' Create a BarcodeReader instance for decoding QR codes
Private reader As New BarcodeReader()

' Decode the QR code from a bitmap image
Private result As Result = reader.Decode(qrCode)

' Extract the text from the decoded QR code
Private text As String = result.Text
$vbLabelText   $csharpLabel

ZXing.org 二維碼庫與 IronBarcode:全面比較:圖 4 - 二維碼產生器

ZXing.org 二維碼庫與 IronBarcode:全面比較:圖 5 - 二維碼檔案顯示

隆重推出 IronBarcode

IronBarcode 是由 Iron Software 開發的 .NET 開發人員的強大條碼產生和掃描程式庫。

IronBarcode提供了一個易於使用的 API,允許開發人員產生和掃描各種條碼類型,包括二維碼、資料矩陣碼和 UPC-A 條碼。

IronBarcode 函式庫是由 Iron Software 創建的,目的是擴展ZXing.NET函式庫的功能。

ZXing.org 二維碼庫和 IronBarcode:全面比較:圖 6 - 支援的條碼格式

它增加了新的功能和功能,例如生成二維條碼、PDF417 條碼以及直接從圖像檔案中讀取條碼的功能。

以下是使用 IronBarcode 產生二維碼的範例:

using IronBarCode;

// Generate a QR code with the text "Hello, IronBarcode!"
var barcode = BarcodeWriter.CreateBarcode("Hello, IronBarcode!", BarcodeWriterEncoding.QRCode);

// Save the generated QR code as a PNG image
barcode.SaveAsImage("qrcode.png");
using IronBarCode;

// Generate a QR code with the text "Hello, IronBarcode!"
var barcode = BarcodeWriter.CreateBarcode("Hello, IronBarcode!", BarcodeWriterEncoding.QRCode);

// Save the generated QR code as a PNG image
barcode.SaveAsImage("qrcode.png");
Imports IronBarCode

' Generate a QR code with the text "Hello, IronBarcode!"
Private barcode = BarcodeWriter.CreateBarcode("Hello, IronBarcode!", BarcodeWriterEncoding.QRCode)

' Save the generated QR code as a PNG image
barcode.SaveAsImage("qrcode.png")
$vbLabelText   $csharpLabel

ZXing.org 二維碼庫和 IronBarcode:全面比較:圖 7 - 二維碼

若要使用 IronBarcode 掃描條碼,您可以使用下列程式碼:

using IronBarCode;

// Read the QR code from the image file "qrcode.png"
var barcode = BarcodeReader.ReadBarcode("qrcode.png", BarcodeEncoding.QRCode);

// Extract the text from the decoded QR code
string text = barcode.Text;
using IronBarCode;

// Read the QR code from the image file "qrcode.png"
var barcode = BarcodeReader.ReadBarcode("qrcode.png", BarcodeEncoding.QRCode);

// Extract the text from the decoded QR code
string text = barcode.Text;
Imports IronBarCode

' Read the QR code from the image file "qrcode.png"
Private barcode = BarcodeReader.ReadBarcode("qrcode.png", BarcodeEncoding.QRCode)

' Extract the text from the decoded QR code
Private text As String = barcode.Text
$vbLabelText   $csharpLabel

ZXing.org 二維碼庫和 IronBarcode:全面比較:圖 8 - 在 C# 中建立條碼影像

IronBarcode支援多種條碼類型,包括二維條碼、UPC-A、UPC-E、EAN-8、EAN-13、Code39、Code128、PDF417 等。

它以ZXing.NET函式庫的優勢為基礎,提供更快、更準確的條碼掃描和生成,同時也增加了新的特性和功能。

如何使用 IronBarcode

以下是使用 IronBarcode 的一些步驟:

步驟 1:安裝 IronBarcode 庫

要在您的 .NET 專案中使用 IronBarcode,您首先需要使用 NuGet 安裝 IronBarcode 程式庫。 您可以透過在 NuGet 套件管理器控制台中執行以下命令來完成此操作:

Install-Package BarCode

步驟 2:產生條碼

若要使用 IronBarcode 產生條碼,您可以使用 BarcodeWriter 類別。

using IronBarCode;

// Generate a QR code with the text "Hello, IronBarcode!"
var barcode = BarcodeWriter.CreateBarcode("Hello, IronBarcode!", BarcodeWriterEncoding.QRCode);

// Save the generated QR code as an image file
barcode.SaveAsImage("qrcode.png");
using IronBarCode;

// Generate a QR code with the text "Hello, IronBarcode!"
var barcode = BarcodeWriter.CreateBarcode("Hello, IronBarcode!", BarcodeWriterEncoding.QRCode);

// Save the generated QR code as an image file
barcode.SaveAsImage("qrcode.png");
Imports IronBarCode

' Generate a QR code with the text "Hello, IronBarcode!"
Private barcode = BarcodeWriter.CreateBarcode("Hello, IronBarcode!", BarcodeWriterEncoding.QRCode)

' Save the generated QR code as an image file
barcode.SaveAsImage("qrcode.png")
$vbLabelText   $csharpLabel

這段程式碼會產生一個包含文字"Hello, IronBarcode!"的二維碼,並將其儲存為名為"qrcode.png"的圖像檔案。

步驟 3:掃描條碼

若要使用 IronBarcode 掃描條碼,您可以使用BarcodeReader類別。

using IronBarCode;

// Read the QR code from the image file "qrcode.png"
var barcode = BarcodeReader.ReadBarcode("qrcode.png", BarcodeEncoding.QRCode);

// Extract the text from the decoded QR code
string text = barcode.Text;
using IronBarCode;

// Read the QR code from the image file "qrcode.png"
var barcode = BarcodeReader.ReadBarcode("qrcode.png", BarcodeEncoding.QRCode);

// Extract the text from the decoded QR code
string text = barcode.Text;
Imports IronBarCode

' Read the QR code from the image file "qrcode.png"
Private barcode = BarcodeReader.ReadBarcode("qrcode.png", BarcodeEncoding.QRCode)

' Extract the text from the decoded QR code
Private text As String = barcode.Text
$vbLabelText   $csharpLabel

這段程式碼從圖像檔案"qrcode.png"讀取二維碼,並傳回條碼中編碼的文字。

ZXing.org 二維碼庫和 IronBarcode:全面比較:圖 9 - 掃描條碼

步驟 4:自訂條碼

IronBarcode 提供了一系列自訂選項,可讓您控制產生的條碼掃描實現的外觀和行為。

以下是如何使用 IronBarcode 自訂二維碼以實現條碼掃描的範例:

using IronBarCode;

// Customize a QR code
var barcode = BarcodeWriter.CreateBarcode("Hello, IronBarcode!", BarcodeWriterEncoding.QRCode);
barcode.ResizeTo(400, 400); // Resize the barcode
barcode.SetMargins(20); // Set margins around the barcode
barcode.SetForegroundColor(Color.Black); // Set the foreground color
barcode.SetBackgroundColor(Color.White); // Set the background color
barcode.AddCaptionAbove("Scan me with your smartphone!"); // Add a caption above the barcode
barcode.AddImageLogo("logo.png", 80, 80); // Add a logo to the barcode
barcode.SaveAsImage("qrcode.png"); // Save the customized barcode as an image
using IronBarCode;

// Customize a QR code
var barcode = BarcodeWriter.CreateBarcode("Hello, IronBarcode!", BarcodeWriterEncoding.QRCode);
barcode.ResizeTo(400, 400); // Resize the barcode
barcode.SetMargins(20); // Set margins around the barcode
barcode.SetForegroundColor(Color.Black); // Set the foreground color
barcode.SetBackgroundColor(Color.White); // Set the background color
barcode.AddCaptionAbove("Scan me with your smartphone!"); // Add a caption above the barcode
barcode.AddImageLogo("logo.png", 80, 80); // Add a logo to the barcode
barcode.SaveAsImage("qrcode.png"); // Save the customized barcode as an image
Imports IronBarCode

' Customize a QR code
Private barcode = BarcodeWriter.CreateBarcode("Hello, IronBarcode!", BarcodeWriterEncoding.QRCode)
barcode.ResizeTo(400, 400) ' Resize the barcode
barcode.SetMargins(20) ' Set margins around the barcode
barcode.SetForegroundColor(Color.Black) ' Set the foreground color
barcode.SetBackgroundColor(Color.White) ' Set the background color
barcode.AddCaptionAbove("Scan me with your smartphone!") ' Add a caption above the barcode
barcode.AddImageLogo("logo.png", 80, 80) ' Add a logo to the barcode
barcode.SaveAsImage("qrcode.png") ' Save the customized barcode as an image
$vbLabelText   $csharpLabel

這段程式碼產生一個帶有文字"Hello, IronBarcode!"的二維碼,並透過將其大小調整為 400x400 像素、添加 20 像素邊距、將前景色設置為黑色、將背景色設置為白色、在條碼上方添加標題以及添加徽標圖像來對其進行自定義。

IronBarcode 能做什麼

IronBarcode 建於開源 ZXing 庫之上,但它擴展了其功能,以支援更廣泛的條碼類型,包括 QR 碼、Code 128、Code 39、EAN-13、EAN-8、UPC-A 等等。

以下是IronBarcode的一些功能:

產生條碼

IronBarcode可輕鬆產生各種類型和樣式的條碼,包括一維條碼和二維條碼,並具有顏色、文字和圖像疊加等可自訂功能。 以下程式碼片段用於產生二維碼:

var barcode = IronBarCode.BarcodeWriter.CreateBarcode("Hello World!", IronBarCode.BarcodeWriterEncoding.QRCode);
barcode.SaveAsJpeg("QRCode.jpg");
var barcode = IronBarCode.BarcodeWriter.CreateBarcode("Hello World!", IronBarCode.BarcodeWriterEncoding.QRCode);
barcode.SaveAsJpeg("QRCode.jpg");
Dim barcode = IronBarCode.BarcodeWriter.CreateBarcode("Hello World!", IronBarCode.BarcodeWriterEncoding.QRCode)
barcode.SaveAsJpeg("QRCode.jpg")
$vbLabelText   $csharpLabel

ZXing.org 二維碼庫與 IronBarcode:全面比較:圖 10 - 待掃描的 Code128 條碼影像

讀取條碼

IronBarcode 還提供功能強大的條碼掃描器,可讀取影像、PDF 和即時攝影機串流中的條碼。 以下程式碼從圖像檔案中讀取二維碼:

var barcode = IronBarCode.BarcodeReader.Read("QRCode.jpg", IronBarCode.BarcodeReaderEncoding.QRCode);
Console.WriteLine(barcode.Text);
var barcode = IronBarCode.BarcodeReader.Read("QRCode.jpg", IronBarCode.BarcodeReaderEncoding.QRCode);
Console.WriteLine(barcode.Text);
Dim barcode = IronBarCode.BarcodeReader.Read("QRCode.jpg", IronBarCode.BarcodeReaderEncoding.QRCode)
Console.WriteLine(barcode.Text)
$vbLabelText   $csharpLabel

ZXing.org 二維碼庫和 IronBarcode:全面比較:圖 11 - 讀取儲存在 PDF 檔案中的條碼

驗證條碼

IronBarcode 還可以驗證條碼,以確保其有效並能被其他條碼閱讀器掃描。 以下程式碼片段用於驗證 Code 128 條碼:

var barcode = IronBarCode.BarcodeReader.Read("Code128.jpg", IronBarCode.BarcodeReaderEncoding.Code128);

// Check if the barcode is valid
if (barcode.IsValid)
{
    Console.WriteLine("Barcode is valid.");
}
else
{
    Console.WriteLine("Barcode is invalid.");
}
var barcode = IronBarCode.BarcodeReader.Read("Code128.jpg", IronBarCode.BarcodeReaderEncoding.Code128);

// Check if the barcode is valid
if (barcode.IsValid)
{
    Console.WriteLine("Barcode is valid.");
}
else
{
    Console.WriteLine("Barcode is invalid.");
}
Dim barcode = IronBarCode.BarcodeReader.Read("Code128.jpg", IronBarCode.BarcodeReaderEncoding.Code128)

' Check if the barcode is valid
If barcode.IsValid Then
	Console.WriteLine("Barcode is valid.")
Else
	Console.WriteLine("Barcode is invalid.")
End If
$vbLabelText   $csharpLabel

條碼轉換

IronBarcode 可以將條碼從一種格式轉換為另一種格式,例如將 Code 39 條碼轉換為 QR 碼。 以下程式碼片段將 Code 39 條碼轉換為 QR 碼:

var barcode = IronBarCode.BarcodeReader.Read("Code39.jpg", IronBarCode.BarcodeReaderEncoding.Code39);
var qrCode = IronBarCode.BarcodeWriter.CreateBarcode(barcode.Text, IronBarCode.BarcodeWriterEncoding.QRCode);
qrCode.SaveAsJpeg("QRCode.jpg");
var barcode = IronBarCode.BarcodeReader.Read("Code39.jpg", IronBarCode.BarcodeReaderEncoding.Code39);
var qrCode = IronBarCode.BarcodeWriter.CreateBarcode(barcode.Text, IronBarCode.BarcodeWriterEncoding.QRCode);
qrCode.SaveAsJpeg("QRCode.jpg");
Dim barcode = IronBarCode.BarcodeReader.Read("Code39.jpg", IronBarCode.BarcodeReaderEncoding.Code39)
Dim qrCode = IronBarCode.BarcodeWriter.CreateBarcode(barcode.Text, IronBarCode.BarcodeWriterEncoding.QRCode)
qrCode.SaveAsJpeg("QRCode.jpg")
$vbLabelText   $csharpLabel

IronBarcode 比 ZXing 線上解碼器好在哪裡?

以下是IronBarcode比ZXing更勝一籌的一些面向:

1.效能: IronBarcode 比 ZXing 速度更快,因此對於需要高速條碼掃描和產生的 Web 應用程式來說,它是一個絕佳的選擇。 2.易用性: IronBarcode 的 API 簡單直觀,只需幾行程式碼即可輕鬆建立和掃描條碼。 另一方面,ZXing 的 API 對於初學者來說可能比較複雜和難以使用。 3.輸出品質: IronBarcode 生產的條碼品質高,即使尺寸很小也易於讀取。 相比之下,ZXing 的條碼有時難以辨認,尤其是在尺寸較小時。 4.支援的格式: IronBarcode 支援多種條碼格式,包括 UPC-A、二維條碼等。 相比之下,ZXing 專案僅支援有限數量的條碼格式。 5.許可: IronBarcode 提供靈活的許可模式,讓開發人員可以根據自身需求免費使用該庫或購買許可證。 相較之下,ZXing 的授權限制較多,使得開發者難以在商業專案中使用該函式庫。

ZXing.org 二維碼庫和 IronBarcode:全面比較:圖 12 - 從多幀 TIFF 影像中讀取條碼

在效能、易用性、輸出品質、支援的格式和授權方面,IronBarcode 都是比 ZXing 更優秀的函式庫。

親眼見證 IronBarcode 的卓越性能

使用下面的免費條碼讀取試用版,體驗 IronBarcode 的所有功能。

IronBarcode 也提供免費試用。

想試試 IronBarcode,看看它如何增強您的條碼掃描和產生能力嗎? 我們很高興為您提供 IronBarcode 的免費試用版,讓您體驗其功能和優勢。

在試用期內,您將可以完全存取 IronBarcode 的所有強大功能,包括支援各種條碼格式、進階自訂選項以及與您現有專案的無縫整合。

要開始試用,只需訪問我們的網站並下載 IronBarcode 軟體包即可。 然後您將獲得免費試用機會,探索 IronBarcode 的所有功能,並親眼見證它如何簡化您的條碼掃描和生成工作流程。

請注意ZXing 是其各自所有者的註冊商標。 本網站與 ZXing 無任何關聯,亦未獲得 ZXing 的認可或贊助。 所有產品名稱、標誌和品牌均為其各自擁有者的財產。 比較資料僅供參考,並反映撰寫時的公開資訊。

常見問題解答

使用 ZXing 進行 BarCode 掃描有哪些限制?

ZXing 是用於條碼掃描的流行開放原始碼程式庫,但整合起來可能會很複雜,而且可能會構成潛在的安全風險。與 IronBarcode 等商業替代品相比,它的格式支援也很有限。

如何在 .NET 中解碼 QR 代碼?

您可以在 .NET 中使用 IronBarcode 解碼 QR 碼,方法是利用其 BarcodeReader 類,該類為讀取和解釋條碼影像提供了直接的 API。

與 ZXing 相比,使用 IronBarcode 有哪些好處?

IronBarcode 提供了更友好的用戶體驗,具有更快的性能、更廣泛的格式支持(包括對 Data Matrix 和 PDF417 的支持)以及增強的條碼外觀定制選項。

.NET 開發人員如何產生具有自訂外觀的 BarCode?

使用 IronBarcode,開發人員可以透過調整大小、設定邊緣、變更顏色、添加標題,以及使用其彈性 API 疊加圖片或標誌來自訂條碼。

是什麼讓 IronBarcode 成為 .NET 開發人員的多功能工具?

IronBarcode 支援各種平台,無需第三方依賴,提供強大的條碼產生和掃描工具集,包括廣泛的自訂和格式選項。

如何將 BarCode 程式庫整合至 .NET 應用程式?

要將 IronBarcode 整合到 .NET 應用程式中,可透過 NuGet 安裝,並使用其 API 以最少的設定來有效率地產生和掃描條碼。

我可以在購買前試用 IronBarcode 嗎?

是的,您可以從 Iron Software 網站下載 IronBarcode 免費試用版,在試用期間可完全使用其功能。

商用 BarCode 程式庫有哪些優點?

IronBarcode 等商業條碼函式庫與開放原始碼的替代品相比,具有更好的性能、易用性、更高的輸出品質、更廣泛的格式支援以及更靈活的授權。

Jordi Bardia
軟體工程師
Jordi 在 Python、C# 和 C++ 上最得心應手,當他不在 Iron Software 展現技術時,便在做遊戲編程。在分担产品测测试,产品开发和研究的责任时,Jordi 为持续的产品改进增值。他说这种多样化的经验使他受到挑战并保持参与, 而这也是他与 Iron Software 中工作一大乐趣。Jordi 在佛罗里达州迈阿密长大,曾在佛罗里达大学学习计算机科学和统计学。