IRONQRの使用 QRCoderを使ったQRコード生成と.NET 6でのIronQRの比較 Jordi Bardia 更新日:6月 22, 2025 Download IronQR NuGet Download Start Free Trial Copy for LLMs Copy for LLMs Copy page as Markdown for LLMs Open in ChatGPT Ask ChatGPT about this page Open in Gemini Ask Gemini about this page Open in Grok Ask Grok about this page Open in Perplexity Ask Perplexity about this page Share Share on Facebook Share on X (Twitter) Share on LinkedIn Copy URL Email article QR Code Generation in C# Creating QR codes in C# applications is a common requirement for developers, especially for applications involving product identification, ticketing, or sharing URLs and other data easily. There are several libraries available for generating QR codes in C#. Two notable options are QRCoder and IronQR. Here, we'll explore both, comparing their capabilities, ease of use, performance, and other factors relevant for developers working with .NET 6. In this article, we'll delve into a detailed comparison of these libraries, examining their features, ease of use, license, and more, along with code samples to illustrate their usage. How to Generate QR code using QRCoder compare to IronQR in .NET 6 Create a new Visual Studio project to Generate a QR code Install QRCoder and IronQR NuGet packages to compare Create QR codes using QRCoder and IronQR Customization Options with QRCoder and IronQR QRCoder QRCoder is an open-source library written in C# and provides QR Code implementation that allows you to generate QR Codes as defined by ISO/IEC 18004 in any .NET application. It’s a lightweight and easy-to-use library with no dependencies on other libraries or network stacks. Here are the key features and benefits of QRCoder: 1. Ease of Use C# QRCoder offers a straightforward and intuitive API, making it easy for developers to generate QR codes/ QR code text with minimal effort. Its simplicity allows developers of all skill levels to quickly integrate QR code generation into their projects. 2. Extensive Customization Options One of the standout features of QRCoder is its ability to customize QR codes according to specific requirements. Developers can adjust parameters such as error correction level, size, color, and even embed logos or images within the QR code. 3. Multiple Encoding Formats QRCoder supports various encoding formats, enabling developers to encode different types of data into QR codes. Whether it's plain text, URLs, contact information, or Wi-Fi credentials, QRCoder can handle a wide range of data formats. 4. High-Quality Output The QR codes generated by C# QRCoder are of high quality, ensuring readability and reliability across different devices and scanning conditions. This reliability is crucial for applications where QR codes serve as a bridge between physical and digital interactions. 5. Open-Source and Active Development C# QRCoder is an open-source project, allowing developers to contribute to its development and ensuring continuous improvements and updates. This active community engagement fosters innovation and ensures that the library remains relevant in the ever-evolving landscape of technology. IronQR IronQR is a powerful C# QR Code library developed and maintained by Iron Software. It allows C# software engineers to detect, read, and create QR Codes in .NET applications and websites. Here are some key features of IronQR: QR Code Generation IronQR enables highly customizable QR code generation. You can create QR codes with various options, such as resizing, margins, borders, and recoloring. using IronQr; using IronSoftware.Drawing; public class Program { public static void Main() { // Prepare a QR Code object QrCode theQrGen = QrWriter.Write("Awesome IronQR"); // Save QR Code to memory AnyBitmap myQrImage = theQrGen.Save(); // Save QR Code image to disk myQrImage.SaveAs("awesome.png"); } } using IronQr; using IronSoftware.Drawing; public class Program { public static void Main() { // Prepare a QR Code object QrCode theQrGen = QrWriter.Write("Awesome IronQR"); // Save QR Code to memory AnyBitmap myQrImage = theQrGen.Save(); // Save QR Code image to disk myQrImage.SaveAs("awesome.png"); } } Imports IronQr Imports IronSoftware.Drawing Public Class Program Public Shared Sub Main() ' Prepare a QR Code object Dim theQrGen As QrCode = QrWriter.Write("Awesome IronQR") ' Save QR Code to memory Dim myQrImage As AnyBitmap = theQrGen.Save() ' Save QR Code image to disk myQrImage.SaveAs("awesome.png") End Sub End Class $vbLabelText $csharpLabel QR Code Reading IronQR uses an advanced Machine Learning Model for QR code detection. This model ensures accurate and fast QR code reading. IronQR supports reading QR codes from various image formats, including JPG, PNG, SVG, bmp, and multipage images like gif and tiff. using IronQr; using IronSoftware.Drawing; using System.Collections.Generic; public class Program { public static void Main() { // Read QR code var inputBmp = AnyBitmap.FromFile("awesome.png"); // Load the image into QrImageInput QrImageInput imageInput = new QrImageInput(inputBmp); // Create the QR Reader object QrReader reader = new QrReader(); // Read the Input and get all embedded QR Codes IEnumerable<QrResult> results = reader.Read(imageInput); } } using IronQr; using IronSoftware.Drawing; using System.Collections.Generic; public class Program { public static void Main() { // Read QR code var inputBmp = AnyBitmap.FromFile("awesome.png"); // Load the image into QrImageInput QrImageInput imageInput = new QrImageInput(inputBmp); // Create the QR Reader object QrReader reader = new QrReader(); // Read the Input and get all embedded QR Codes IEnumerable<QrResult> results = reader.Read(imageInput); } } Imports IronQr Imports IronSoftware.Drawing Imports System.Collections.Generic Public Class Program Public Shared Sub Main() ' Read QR code Dim inputBmp = AnyBitmap.FromFile("awesome.png") ' Load the image into QrImageInput Dim imageInput As New QrImageInput(inputBmp) ' Create the QR Reader object Dim reader As New QrReader() ' Read the Input and get all embedded QR Codes Dim results As IEnumerable(Of QrResult) = reader.Read(imageInput) End Sub End Class $vbLabelText $csharpLabel Cross-Platform Compatibility Desktop: Works with Windows desktop applications (WPF & MAUI). Mobile: Compatible with Xamarin and MAUI. Web: Supports Blazor and WebForms. Console: App and library environments. Cloud: Docker, Azure, and AWS. Encoding Data You can encode various types of data in QR codes, including text, URLs, bytes, and numbers. Error Correction IronQR provides detailed error messages and custom error correction options. Trusted by Millions, IronQR is trusted by engineers worldwide for its reliability and ease of use. To get started with IronQR, you can install it via NuGet. Step 1: Create a new Visual Studio project to Generate a QR code To get started with the code, let us create a Visual Studio Project. Open Microsoft Visual Studio 2022 and select "Create a new project" option. Select the Console application template from the template list Then provide the project name and the solution names. Select the path to store the project files Select the required .NET version. I will go with the latest .NET 8 framework at the time of writing this article. Once you click the create button the project is created and ready for development. Step 2: Install QRCoder and IronQR NuGet packages The QRCoder NuGet package can be installed using Visual Studio NuGet package manager as shown below. Or install it from NuGet package manager console using the following command dotnet add package QRCoder --version 1.4.3 The QRCoder NuGet package is available on the NuGet website here The IronQR can also be installed similarly using the Visual Studio NuGet package manager, shown below. Also from the NuGet package manager console, use the following command dotnet add package IronQR --version 2024.4.1 Step 3: Create QR codes using QRCoder and IronQR Creating QR codes in the two libraries requires simple code, let's check them out QRCoder The following code shows how to generate our first QR code using QRCoder using QRCoder; using System.Drawing; using System.IO; namespace QRCoderVsIronQR { public class Program { public static void Main() { // Initialize QRCodeGenerator using (QRCodeGenerator qrGenerator = new QRCodeGenerator()) // Create QR code data using (QRCodeData qrCodeData = qrGenerator.CreateQrCode("QRCoder Demo 1", QRCodeGenerator.ECCLevel.Q)) // Initialize the QR code with the data using (BitmapByteQRCode qrCode = new BitmapByteQRCode(qrCodeData)) { // Generate the QR code's graphic and store it in a byte array byte[] qrCodeImage = qrCode.GetGraphic(20); // Convert the byte array to an image format and save it to disk using (var file = Image.FromStream(new MemoryStream(qrCodeImage))) { file.Save("QrCoderDemo1.png"); } } } } } using QRCoder; using System.Drawing; using System.IO; namespace QRCoderVsIronQR { public class Program { public static void Main() { // Initialize QRCodeGenerator using (QRCodeGenerator qrGenerator = new QRCodeGenerator()) // Create QR code data using (QRCodeData qrCodeData = qrGenerator.CreateQrCode("QRCoder Demo 1", QRCodeGenerator.ECCLevel.Q)) // Initialize the QR code with the data using (BitmapByteQRCode qrCode = new BitmapByteQRCode(qrCodeData)) { // Generate the QR code's graphic and store it in a byte array byte[] qrCodeImage = qrCode.GetGraphic(20); // Convert the byte array to an image format and save it to disk using (var file = Image.FromStream(new MemoryStream(qrCodeImage))) { file.Save("QrCoderDemo1.png"); } } } } } Imports QRCoder Imports System.Drawing Imports System.IO Namespace QRCoderVsIronQR Public Class Program Public Shared Sub Main() ' Initialize QRCodeGenerator Using qrGenerator As New QRCodeGenerator() ' Create QR code data Using qrCodeData As QRCodeData = qrGenerator.CreateQrCode("QRCoder Demo 1", QRCodeGenerator.ECCLevel.Q) ' Initialize the QR code with the data Using qrCode As New BitmapByteQRCode(qrCodeData) ' Generate the QR code's graphic and store it in a byte array Dim qrCodeImage() As Byte = qrCode.GetGraphic(20) ' Convert the byte array to an image format and save it to disk Using file = Image.FromStream(New MemoryStream(qrCodeImage)) file.Save("QrCoderDemo1.png") End Using End Using End Using End Using End Sub End Class End Namespace $vbLabelText $csharpLabel Code Explanation Initialize the QRCodeGenerator and call the CreateQrCode method to generate QR code data. Use the BitmapByteQRCode class to generate a byte array from the QR code data using the GetGraphic method. Convert the byte array to an image using Image.FromStream. Save the generated image to disk. Output IronQR The following code shows how to generate QR code using IronQR: using IronQr; using IronSoftware.Drawing; namespace QrCodeWithIronQR { public class Program { public static void Main() { // Prepare a QR Code object QrCode theQrGen = QrWriter.Write("Awesome IronQR"); // Save QR Code to memory AnyBitmap myQrImage = theQrGen.Save(); // Save QR Code image to disk myQrImage.SaveAs("awesome.png"); } } } using IronQr; using IronSoftware.Drawing; namespace QrCodeWithIronQR { public class Program { public static void Main() { // Prepare a QR Code object QrCode theQrGen = QrWriter.Write("Awesome IronQR"); // Save QR Code to memory AnyBitmap myQrImage = theQrGen.Save(); // Save QR Code image to disk myQrImage.SaveAs("awesome.png"); } } } Imports IronQr Imports IronSoftware.Drawing Namespace QrCodeWithIronQR Public Class Program Public Shared Sub Main() ' Prepare a QR Code object Dim theQrGen As QrCode = QrWriter.Write("Awesome IronQR") ' Save QR Code to memory Dim myQrImage As AnyBitmap = theQrGen.Save() ' Save QR Code image to disk myQrImage.SaveAs("awesome.png") End Sub End Class End Namespace $vbLabelText $csharpLabel As you can already see the difference in the amount of code. IronQR code generation requires less code. Code Explanation Create the QR code using the QrWriter.Write method, passing the desired content. Save the QR code to memory using the Save method. Save the QR code image to disk using SaveAs. Output The output has an IronQR watermark since I am using a trial version of the library. With a licensed version, this will be removed. Step 4: Customization Options with QRCoder and IronQR Both libraries support customization options. Let's look at some options available We can set the QR code colors in QRCoder like below: using QRCoder; using System.Drawing; using System.IO; namespace QRCoderVsIronQR { public class Program { public static void Main() { // Initialize QRCodeGenerator using (QRCodeGenerator qrGenerator = new QRCodeGenerator()) // Create QR code data using (QRCodeData qrCodeData = qrGenerator.CreateQrCode("QRCoder Demo 1", QRCodeGenerator.ECCLevel.Q)) // Initialize the QR code with the data using (BitmapByteQRCode qrCode = new BitmapByteQRCode(qrCodeData)) { // Generate the QR code's graphic, specifying foreground and background colors byte[] qrCodeImage = qrCode.GetGraphic(20, Color.Red, Color.Green); // Convert the byte array to an image format and save it to disk using (var file = Image.FromStream(new MemoryStream(qrCodeImage))) { file.Save("QrCoderDemo1.png"); } } } } } using QRCoder; using System.Drawing; using System.IO; namespace QRCoderVsIronQR { public class Program { public static void Main() { // Initialize QRCodeGenerator using (QRCodeGenerator qrGenerator = new QRCodeGenerator()) // Create QR code data using (QRCodeData qrCodeData = qrGenerator.CreateQrCode("QRCoder Demo 1", QRCodeGenerator.ECCLevel.Q)) // Initialize the QR code with the data using (BitmapByteQRCode qrCode = new BitmapByteQRCode(qrCodeData)) { // Generate the QR code's graphic, specifying foreground and background colors byte[] qrCodeImage = qrCode.GetGraphic(20, Color.Red, Color.Green); // Convert the byte array to an image format and save it to disk using (var file = Image.FromStream(new MemoryStream(qrCodeImage))) { file.Save("QrCoderDemo1.png"); } } } } } Imports QRCoder Imports System.Drawing Imports System.IO Namespace QRCoderVsIronQR Public Class Program Public Shared Sub Main() ' Initialize QRCodeGenerator Using qrGenerator As New QRCodeGenerator() ' Create QR code data Using qrCodeData As QRCodeData = qrGenerator.CreateQrCode("QRCoder Demo 1", QRCodeGenerator.ECCLevel.Q) ' Initialize the QR code with the data Using qrCode As New BitmapByteQRCode(qrCodeData) ' Generate the QR code's graphic, specifying foreground and background colors Dim qrCodeImage() As Byte = qrCode.GetGraphic(20, Color.Red, Color.Green) ' Convert the byte array to an image format and save it to disk Using file = Image.FromStream(New MemoryStream(qrCodeImage)) file.Save("QrCoderDemo1.png") End Using End Using End Using End Using End Sub End Class End Namespace $vbLabelText $csharpLabel Code Explanation Initialize the QRCodeGenerator and call the CreateQrCode method to generate QR code data. Use the BitmapByteQRCode class to generate a byte array from the QR code data using the GetGraphic method, specifying the foreground (red) and background (green) colors. Convert the byte array to an image using Image.FromStream. Save the generated image to disk. Output We can set colors for IronQR QR code generation like following code: using IronQr; using IronSoftware.Drawing; using System.Drawing; namespace QrCodeWithIronQR { public class Program { public static void Main() { // Set options QrOptions options = new QrOptions(QrErrorCorrectionLevel.Medium, 20); // Create QR QrCode myQr = QrWriter.Write("IronQR Generation Demo 1", options); // Style options AnyBitmap logoBmp = new AnyBitmap("logo.png"); QrStyleOptions style = new QrStyleOptions { BackgroundColor = Color.Aqua, Dimensions = 300, // px Margins = 10, // px Color = Color.Red, Logo = new QrLogo { Bitmap = logoBmp, Width = 100, Height = 100, CornerRadius = 2 } }; // Save QR Code AnyBitmap qrImage = myQr.Save(style); // Save QR Code to local disk qrImage.SaveAs("advancedQr.png"); } } } using IronQr; using IronSoftware.Drawing; using System.Drawing; namespace QrCodeWithIronQR { public class Program { public static void Main() { // Set options QrOptions options = new QrOptions(QrErrorCorrectionLevel.Medium, 20); // Create QR QrCode myQr = QrWriter.Write("IronQR Generation Demo 1", options); // Style options AnyBitmap logoBmp = new AnyBitmap("logo.png"); QrStyleOptions style = new QrStyleOptions { BackgroundColor = Color.Aqua, Dimensions = 300, // px Margins = 10, // px Color = Color.Red, Logo = new QrLogo { Bitmap = logoBmp, Width = 100, Height = 100, CornerRadius = 2 } }; // Save QR Code AnyBitmap qrImage = myQr.Save(style); // Save QR Code to local disk qrImage.SaveAs("advancedQr.png"); } } } Imports IronQr Imports IronSoftware.Drawing Imports System.Drawing Namespace QrCodeWithIronQR Public Class Program Public Shared Sub Main() ' Set options Dim options As New QrOptions(QrErrorCorrectionLevel.Medium, 20) ' Create QR Dim myQr As QrCode = QrWriter.Write("IronQR Generation Demo 1", options) ' Style options Dim logoBmp As New AnyBitmap("logo.png") Dim style As New QrStyleOptions With { .BackgroundColor = Color.Aqua, .Dimensions = 300, .Margins = 10, .Color = Color.Red, .Logo = New QrLogo With { .Bitmap = logoBmp, .Width = 100, .Height = 100, .CornerRadius = 2 } } ' Save QR Code Dim qrImage As AnyBitmap = myQr.Save(style) ' Save QR Code to local disk qrImage.SaveAs("advancedQr.png") End Sub End Class End Namespace $vbLabelText $csharpLabel With IronQR there are many customization options. In the above program we have tried to customize the background color, QR code color, margins. We can also set dimensions. Code Explanation First, create the QrOptions object to set the error correction level. Prepare the QR code with QrWriter.Write method. Set the style options with QrStyleOptions. Set the background color, foreground color, margins, dimensions, and even a logo for the QR code. Save the QR code image to the local disk. Output Licensing QRCoder is a MIT license-based package and is developed with the help of the community. This package is good for small-budget projects. The user needs to wait for the community to resolve issues or can fix and push the code to the Git Repository with pull requests approved. IronQR requires a license. It has backing from Iron Software. A IronQR trial license can be obtained. The obtained key needs to be placed in the appSettings.json file here: { "IronQR.License.LicenseKey": "myKey" } Conclusion Choosing between C# QRCoder and IronQR ultimately depends on the specific requirements of your project. If you need a free and open source QR code generation library with a lot of customization options, then C# QRCoder might be the preferred choice due to its simplicity and extensive customization options. If you need an enterprise-level library that supports not only QR code generation with customization options but also supports QR code reading, then IronQR would be the ultimate choice. With the IronQR library, its many benefits, and support functionality from Iron Software, developers can write enterprise applications with ease and peace of mind. よくある質問 C#でQRコードを生成する方法は? QRCoderやIronQRのようなライブラリを使用してC#でQRコードを生成できます。QRCoderはオープンソースで、幅広いカスタマイズを提供し、IronQRは高度な機能とクロスプラットフォームサポートを提供し、企業レベルのアプリケーションに理想的です。 QRCoderを.NET 6プロジェクトで使用する利点は何ですか? QRCoderは.NET 6プロジェクトにおいて、使いやすさ、幅広いカスタマイズオプション、および複数のエンコーディングフォーマットをサポートするため、有益です。また、MITライセンスの下で無料で使用できるため、予算を意識したプロジェクトに最適です。 IronQRを使用してQRコードをどのようにカスタマイズできますか? IronQRは、背景色、QRコードの色、余白、寸法の調整、さらにはQRコードの見た目を向上させるためのロゴの追加など、開発者がQRコードをカスタマイズできるようにします。 クロスプラットフォームアプリケーションにおけるIronQRの利点は何ですか? IronQRはデスクトップ(WPF & MAUI)、モバイル(XamarinとMAUI)、Web(BlazorとWebForms)、コンソールアプリ、Docker、Azure、AWSのようなクラウド環境を含むクロスプラットフォームアプリケーションをサポートし、多用途な開発ニーズに理想的です。 Visual StudioでQRコード生成プロジェクトを設定するために必要な手順は何ですか? Visual StudioでQRコード生成プロジェクトを設定するには、選択に応じてQRCoderまたはIronQRの必要なNuGetパッケージをインストールする必要があります。この記事では、プロセスをガイドするための段階的な手順とコードサンプルを提供しています。 IronQRはQRコードのエラー訂正をどのように向上させますか? IronQRは、QRコードが損傷したり部分的に遮られていても正確に読み取れるようにする詳細なオプションを提供し、QRコードのエラー訂正を向上させます。これは、重要なアプリケーションにおいて非常に信頼性が高いものとします。 IronQRのライセンスオプションはどのようなものがありますか? IronQRは企業レベルのプロジェクトに対し、ロバストなサポートと機能を保証する商用ライセンスが必要で、試用ライセンスを入手して評価が可能です。 シンプルなQRコードプロジェクトのためにどのライブラリを選ぶべきですか? シンプルなQRコードプロジェクトには、その簡潔さ、使いやすさ、費用対効果からQRCoderが推奨されます。これはMITライセンスの下で動作するオープンソースライブラリです。 IronQRはさまざまな画像形式からQRコードを読み取ることができますか? はい、IronQRは高度な機械学習モデルを使用してさまざまなプラットフォームにおける迅速で正確な読み取りを保証する形でさまざまな画像形式からQRコードを読み取れます。 Jordi Bardia 今すぐエンジニアリングチームとチャット ソフトウェアエンジニア Jordiは、最も得意な言語がPython、C#、C++であり、Iron Softwareでそのスキルを発揮していない時は、ゲームプログラミングをしています。製品テスト、製品開発、研究の責任を分担し、Jordiは継続的な製品改善において多大な価値を追加しています。この多様な経験は彼を挑戦させ続け、興味を持たせており、Iron Softwareで働くことの好きな側面の一つだと言います。Jordiはフロリダ州マイアミで育ち、フロリダ大学でコンピュータサイエンスと統計学を学びました。 関連する記事 更新日 9月 18, 2025 C#で画像からQRを読む方法 このガイドでは、高性能のQRコードライブラリIronQRを使って、C#コードを使って簡単に画像からQRコードを読み取る方法を説明します。 詳しく読む 更新日 8月 20, 2025 QRコードスキャナーのために.NET MAUIを使用する方法 この投稿では、IronQRを使って.NET MAUIバーコードスキャナーとQRコードリーダーを作成する方法を説明します。 詳しく読む 更新日 7月 28, 2025 Visual StudioでQRコードを生成する方法 また、Visual StudioのNuGetパッケージマネージャで「IronQR」を検索し、最新の安定バージョンを選択する方法もあります。 詳しく読む C#でQRコードジェネレーターアプリケーションを作成する方法VB.NETでQRコードを生成する...
更新日 9月 18, 2025 C#で画像からQRを読む方法 このガイドでは、高性能のQRコードライブラリIronQRを使って、C#コードを使って簡単に画像からQRコードを読み取る方法を説明します。 詳しく読む
更新日 8月 20, 2025 QRコードスキャナーのために.NET MAUIを使用する方法 この投稿では、IronQRを使って.NET MAUIバーコードスキャナーとQRコードリーダーを作成する方法を説明します。 詳しく読む
更新日 7月 28, 2025 Visual StudioでQRコードを生成する方法 また、Visual StudioのNuGetパッケージマネージャで「IronQR」を検索し、最新の安定バージョンを選択する方法もあります。 詳しく読む