フッターコンテンツにスキップ
他のコンポーネントと比較する

IronBarcodeとQrCoder C#の比較

このチュートリアルでは、QRコードとバーコードを扱うためのC#ライブラリであるIronBarcodeとQrCoderを比較します。

まず、両方のライブラリの簡単な紹介から始めましょう:

IronBarcode

IronBarcodeは、Iron Softwareによって作成および維持されているライブラリで、C#ソフトウェアエンジニアが.NETアプリケーションやウェブサイトでバーコードやQRコードを読み書きできるようにします。 これは、すべての.NET Frameworkおよび.NET Core FrameworkでNuGetで利用できます。 IronBarcodeは、バーコードを読み書きするために1行のコードしか必要としません。

QrCoder

QRCoderは、QRコードを作成できるシンプルなC#ライブラリです。 他のライブラリへの依存はなく、.NET Frameworkおよび.NET Core PCLバージョンではNuGetで利用できます。

両方のライブラリは、次の主要な機能を持つべきです:

  • QRコードのスキャン
  • バーコードのスキャン
  • QRコードの生成
  • バーコードの生成

これらの機能は両方のライブラリから実装し、そのパフォーマンスを比較します。

最初に、Visual Studioプロジェクトに両方のライブラリをインストールしましょう。 両方のライブラリには独自のNuGetパッケージがあるため、NuGet Package Manager Consoleを介してインストールします。

IronBarcodeのインストール

IronBarcodeをインストールするには、Package Manager Consoleで次のコマンドを入力します:

Install-Package BarCode

これにより、プロジェクトにIronBarcodeライブラリがインストールされます。

class="content-img-align-center"> A Comparison Between IronBarcode and QrCoder C# - Figure 1: Installing IronBarcode

class="content__image-caption">Installing IronBarcode

QrCoderのインストール

Package Manager Consoleで次のコマンドを入力します:

Install-Package QRCoder

これにより、プロジェクトにQrCoderライブラリがインストールされます。

class="content-img-align-center"> A Comparison Between IronBarcode and QrCoder C# - Figure 2: Installing QrCoder

class="content__image-caption">Installing QrCoder

さて、両方のライブラリを使って最初のQRコードを生成します。

IronBarcodeを使用したQRコードの生成

次のコードはQRコードを生成します。

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インスタンスは、ライブラリの効率を分析するためにプログラムの実行時間を測定するために作成されます。

class="content-img-align-center"> A Comparison Between IronBarcode and QrCoder C# - Figure 3: IronBarcode Result

class="content__image-caption">Generated Barcode from IronBarcode

IronBarcodeの実行時間

IronBarcodeはQRコードを生成して保存するのに3503msかかります。

class="content-img-align-center"> A Comparison Between IronBarcode and QrCoder C# - Figure 4: Execution Time

class="content__image-caption">IronBarcode's execution time for generating new Barcodes

QRCoderを使ってQRコードを作成する

次のサンプルコードはQrCoderを使用してQRコードを生成します。

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はQRコードを画像として保存するための組み込みの関数を提供していません。 しかし、QrCoderをBitmapオブジェクトに解析することで保存できます。 その後、Bitmapが提供する保存機能を使用してQRコードを保存できます。

class="content-img-align-center"> A Comparison Between IronBarcode and QrCoder C# - Figure 5: QR Coder Result

class="content__image-caption">QrCoder's generated barcode

QrCoderの実行時間

QrCoderはQRコードを生成して保存するのに592msかかります。

class="content-img-align-center"> A Comparison Between IronBarcode and QrCoder C# - Figure 6: QrCoder's Execution Time

class="content__image-caption">The time that it took QrCoder to generate a new barcode

分析

IronBarcodeの実行時間は3503msですが、QrCoderは592msしかかかりません。 これにより、QrCoderはパフォーマンスの面でIronBarcodeより速いです。

IronBarcodeでQRコードを生成する方がはるかに簡単で、コードを2行しか書く必要がありません。 QrCoderライブラリでは、コードを5行書く必要があります。

IronBarcodeは生成されたQRコードをファイルに保存するための組み込みの機能も提供しており、QrCoderはそうではありません。 ファイルに保存するためにQRコードのビットマップオブジェクトを作成する必要があります。QrCoderを使用してQRコードを生成するには4つのオブジェクトを作成する必要があります。 IronBarcodeで同じことをするためには、1つのオブジェクトを作成するだけで済みます。

次に、両方のライブラリを使用してバーコードを生成します。

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
class="content-img-align-center"> A Comparison Between IronBarcode and QrCoder C# - Figure 7: Generated barcode using IronBarcode

class="content__image-caption">Generated barcode using IronBarcode

IronBarcodeを使用してバーコードを生成するためにかかる実行時間は次のとおりです:

class="content-img-align-center"> A Comparison Between IronBarcode and QrCoder C# - Figure 8: Execution time for IronBarcode to generate a new Barcode

class="content__image-caption">IronBarcode's Barcode generation time

バーコード生成に3756msまたは3.76秒かかります。

QrCoderを使用してバーコードを生成する

QrCoderライブラリはバーコードを作成する機能を提供していないことに注意してください。 したがって、バーコードを作成する必要がある場合、IronBarcodeはより良い選択肢です。

QRコードのスキャンに関しては、どのライブラリが最適な選択肢になるか見てみましょう。

IronBarcodeを使用してQRコードを読み取る

次のコードはIronBarcodeを使用してQRコードを読み取ります。

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はQRコードを読み取る結果としてEnumerableを返します。 Enumerableをループして各結果を取得する必要があります。 この機能は、文書からのQRコードや複数のQRコードを含む画像からQRコードを読み取るのに便利です。

class="content-img-align-center"> A Comparison Between IronBarcode and QrCoder C# - Figure 9: IronBarcode's QR Code Scanning Execution Time

class="content__image-caption">The time it takes IronBarcode to read/scan all QR codes from a document

IronBarcodeを使用して3136msまたは3.1秒かかります。

QrCoderを使用してQRコードを読み取る

QrCoderライブラリはQRコードの読み取りまたはスキャン機能を提供していません。

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を返します。 各結果を取得するためにそれをループする必要があります。 複数のバーコードを含む文書または画像からバーコードを読み取るのに便利です。

上記のコードで生成される出力は次の通りです:

class="content-img-align-center"> A Comparison Between IronBarcode and QrCoder C# - Figure 10: Execution time for IronBarcode Scan one or more barcodes

class="content__image-caption">The time IronBarcode takes to scan a barcode contained in a PDF or an image

QrCoderを使用してバーコードを読み取る

QrCoderライブラリはQRコードの読み取りまたはスキャン機能を提供していません。

さて、両方のライブラリのライセンスオプションについて議論しましょう。

ライセンス

ライセンス for IronBarcode

IronBarcodeは開発用に無料です。 ただし、Visual Studio開発環境外での導入にはライセンスが必要です。 ライセンス価格は$liteLicenseから$unlimitedLicense(USD)の範囲です。 完全なIron Suiteを購入すれば割引が受けられます。

class="content-img-align-center"> A Comparison Between IronBarcode and QrCoder C# - Figure 11: Iron Licenses

class="content__image-caption">Check out IronBarcode's [licensing page](/csharp/barcode/licensing/) for more information about available licenses.

ライセンス for QrCoder

QrCoderはオープンソースで、ライセンスは不要です。 どのような環境でも自由に使用できます。 オープンソース開発が好きなら、そのソースコードに貢献することもできます。

QrCoderを使用すべき場合

QRコードの生成機能だけが必要な場合、QRCoderは無料で使用でき、支払いまたはサブスクリプション料を必要としないので、最適な選択です。

IronBarcodeを使用すべき場合

IronBarcodeは、次のような生成QRコードを超える機能を必要とする場合の優れた選択です:

  • 画像やPDFからの単一または複数のバーコードおよびQRコードの読み取り。
  • ゆがみ、方向、ノイズ、低解像度、コントラストなどの画像修正
  • バーコードの生成とそれを画像またはPDF文書に適用
  • HTML文書にバーコードを埋め込む。
  • バーコードのスタイリングと注釈テキストの追加
  • ロゴ、色、詳細なQRアライメントを追加可能なQRコードの作成

まとめ

以下の表は、IronBarcodeとQrCoderの両方を比較しています。

class="content-img-align-center"> A Comparison Between IronBarcode and QrCoder C# - Figure 12: Comparing the two libraries

class="content__image-caption">Side-by-side comparison of IronBarcode and QrCoder

結論

IronBarcode for .NETは、開発者が1行のコードで.NETアプリケーションでバーコードとQRコードを読み書きできるようにします。 このライブラリは、39/93/128、UPC A/E、EAN 8/13、QRなど、ほとんどのバーコードとQRコード標準をサポートしています。 ライブラリはバーコード画像を自動的に事前処理し、回転、ノイズ、歪み、ゆがみの修正を提供して速度と精度を向上させます。 IronBarcodeは32ビットおよび64ビットシステム、すべての.NET言語、およびデスクトップ、コンソール、クラウド、モバイルおよびWebアプリケーションを含むさまざまなプラットフォームと互換性があります。 また、開発者にPDF、JPG、TIFF、GIF、BMP、PNG、HTML文書用のバーコードとQRコードを書き込み、テキストの色、サイズ、回転、品質を変更することを可能にします。 ライブラリは安全で、ウェブサービスを使用せず、データをインターネット経由で送信しません。 IronBarcodeは無料試用版が利用可能であり、個人使用向けのLiteバージョン、最大10人の開発者のチーム向けのProfessionalパッケージ、企業向けのUnlimitedパッケージを含む3つのライセンスオプションを提供します。

QRCoderは、他のライブラリに依存せず、ISO/IEC 18004に基づいてQRコードを生成するC# .NETライブラリです。 QRコードのレンダリングクラスには、QRCode、ArtQRCode、AsciiQRCode、その他が含まれます。 ただし、すべてのレンダラーがすべてのターゲットフレームワークで利用可能であるわけではなく、.NET Standard/.NET >=5.0バージョンにはいくつかの制約があります。 QRCoderは無料であり、ライセンスは不要です。

IronBarcodeは、サポートされているすべての.NET Frameworkバージョン、広範な機能、SaaSおよびOEM配布範囲を備えているため、QrCoderよりも多用途です。 IronBarcodeは包括的なドキュメンテーションと24時間年中無休のサポートも提供しているのに対し、QrCoderは提供していません。 IronBarcodeにはライセンス料がありますが、その機能とサポートを考慮すると妥当です。

IronBarcode is a library developed by Iron Software, which also offers other useful libraries, including IronPDF, IronXL, IronOCR, and IronWebScraper. 完全なIron Suiteを購入すると、5製品すべてを破格の割引で入手できます。

要約すると、IronBarcodeはバーコードとQRコードの両方を扱う必要がある人、およびバーコードジェネレータ、QRコードジェネレータ、バーコードリーダ、QRコードリーダを作成したい人に最適です。 一方、QrCoderはQRコードジェネレータを作成するだけで良いという人に適しています。

ご注意QrCoder is a registered trademark of its respective owner. このサイトは、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を使用します。

QRコード生成のためのIronBarcodeとQrCoderの実行時間の違いは何ですか?

QrCoderはより高速で、QRコードを生成して保存するのに約592msを要しますが、IronBarcodeでは約3503msです。ただし、IronBarcodeは単なるQRコード生成以上の高度な機能を提供しています。

IronBarcodeはデプロイにライセンスを必要としますか?

はい、IronBarcodeはVisual Studio開発環境外でのデプロイにライセンスを必要とします。Lite、Professional、Unlimitedパッケージを含むさまざまなライセンスオプションを提供します。

IronBarcodeはバーコード処理のためにどのような機能を提供していますか?

IronBarcodeはバーコードとQRコードの読み書き、画像補正、スタイリングオプション、およびバーコードをPDFなどのドキュメントに埋め込む能力を提供し、包括的なバーコード処理ツールとなっています。

シンプルなQRコード生成のためにどのライブラリを選ぶべきですか?

シンプルなQRコード生成には、使いやすさと無料ライセンスのためにQrCoderが適しています。ただし、より高度な作業にはIronBarcodeが推奨されます。

C#でQRコードをPDFに統合できますか?

はい、IronBarcodeを使用してQRコードをPDFに統合できます。QRコードやバーコードの読み書き、ドキュメントへのシームレスな埋め込みなどの機能を提供しています。

Jordi Bardia
ソフトウェアエンジニア
Jordiは、最も得意な言語がPython、C#、C++であり、Iron Softwareでそのスキルを発揮していない時は、ゲームプログラミングをしています。製品テスト、製品開発、研究の責任を分担し、Jordiは継続的な製品改善において多大な価値を追加しています。この多様な経験は彼を挑戦させ続け、興味を持たせており、Iron Softwareで働くことの好きな側面の一つだと言います。Jordiはフロリダ州マイアミで育ち、フロリダ大学でコンピュータサイエンスと統計学を学びました。