IRONSOFTWAREHOME

How to Create a QR Code Image in C# with IronQR

Curtis Chau
Curtis Chau
Updated: August 2, 2026

To create a QR code image in C#, use IronQR's QrWriter.Write() method to generate the code, then Save() to get an AnyBitmap object and SaveAs() to export it to your preferred image format like PNG or JPEG.

Quickstart: Create Your First QR Code Image
  1. Install IronQR via NuGet Package Manager
  2. Add using IronQr; and using IronSoftware.Drawing;
  3. Generate QR code: QrCode qrCode = QrWriter.Write("your text");
  4. Save to bitmap: AnyBitmap anyBitmap = qrCode.Save();
  5. Export as image: anyBitmap.SaveAs("myQRCode.png", AnyBitmap.ImageFormat.Png);

Here's a complete example to get you started:

  1. 1Install IronQR with NuGet Package Manager

    PM > Install-Package IronQR

  2. 2Copy and run this code snippet.

    using IronQr;
    using IronSoftware.Drawing;
    
    // Generate a simple QR code
    QrCode myQrCode = QrWriter.Write("Hello, World!");
    
    // Save as an image bitmap
    AnyBitmap qrImage = myQrCode.Save();
    
    // Export to PNG file
    qrImage.SaveAs("hello-world-qr.png");
    C#
  3. 3Deploy to test on your live environment

    Start using IronQR in your project today with a free trial
    arrow pointer

QR codes encode data as visual patterns of black and white squares that cameras and scanners can read. These two-dimensional matrices store URLs, text, or other information in a compact, scannable format. For more advanced examples, check out the QR quickstart guide.

How Do I Create QR Code as Images?

What Code Do I Need to Generate a QR Code?

Creating QR codes with IronQR requires minimal code. Generate the QR code object with one line, then export it as an image using the Save and SaveAs methods. The QrWriter class provides all the functionality for generating QR codes.

using IronQr;
using IronSoftware.Drawing;

// Creating a QR code
QrCode qrCode = QrWriter.Write("12345");

// Save QR code to AnyBitmap
AnyBitmap anyBitmap = qrCode.Save();

// Save AnyBitmap to PNG
anyBitmap.SaveAs("simpleQrCode.png", AnyBitmap.ImageFormat.Png);
Example QR code generated showing the visual output from QR code creation process

Which Image Formats Can I Export To?

The Save method returns an AnyBitmap object that supports multiple export formats:

  • JPEG (.jpg or .jpeg): Compressed format for photos using lossy compression.
  • PNG (.png): Lossless format ideal for web use with transparency support.
  • Bmp (.bmp): Uncompressed Windows format producing large, high-quality files.
  • GIF (.gif): Supports animations and transparency with 256-color limit.
  • TIFF (.tiff or .tif): Flexible format for professional photography.
  • WBMP (.wbmp): Monochrome format for wireless communication.
  • WebP (.webp): Modern format with excellent lossy and lossless compression.
  • Icon (.ico): Small square images for program and file icons.
  • WMF (.wmf): Vector and raster format for Windows graphics.
  • RawFormat (.raw): Unprocessed image data for professional editing.

Why Should I Choose PNG Over JPEG for QR Codes?

PNG provides lossless compression and sharp edges essential for QR code readability. JPEG's lossy compression can blur QR code edges, potentially affecting scan reliability. PNG ensures crisp lines for optimal scanning across all devices and conditions.

PNG's transparency support adds value for styled QR codes with logos or custom colors. Learn more about creating styled QR codes with advanced customization in our advanced guide.

How Can I Control QR Code Size and Quality?

IronQR provides options to control size and quality:

using IronQr;
using IronSoftware.Drawing;

// Create QR code with custom dimensions
QrOptions options = new QrOptions(QrErrorCorrectionLevel.High, 20);
QrCode qrCode = QrWriter.Write("https://ironsoftware.com", options);

// Save with specific dimensions
AnyBitmap qrImage = qrCode.Save(new QrStyleOptions { Dimensions = 500 });

// Save to file
qrImage.SaveAs("custom-size-qr.png");
C#

Error correction determines damage tolerance while maintaining readability. Higher levels create complex QR codes with better fault tolerance, detailed in our fault tolerance documentation.


What QR Code Types Are Supported?

Which QR Code Type Should I Use for Standard Applications?

IronQR supports all major QR code formats for diverse application needs:

  • QRCode: Standard QR code storing up to 7,089 numeric or 4,296 alphanumeric characters. Suitable for URLs, contact information, and general data storage.
Example QR code showing standard black and white matrix pattern with corner positioning squares

When Should I Use Micro QR Codes?

  • MicroQRCode: Smaller version for space-limited applications. Stores up to 35 numeric or 21 alphanumeric characters. Ideal for small packaging or tiny labels.
Standard QR code showing typical black and white square pattern with finder corners and data modules

What Are RMQR Codes Best Used For?

  • RMQRCode: Rectangular Micro QR Code with flexible aspect ratio. Stores data similar to Micro QR Code but fits rectangular spaces.
Example QR code showing standard matrix pattern with positioning markers and encoded data squares

Best Practices for QR Code Image Generation

What Are the Key Considerations for Production QR Codes?

Consider these factors for production QR codes:

  1. Error Correction Level: Use High (H) for printed materials that may get damaged. Medium (M) suffices for digital displays.
  2. Quiet Zone: Maintain white space at least 4 modules wide around the QR code for optimal scanning.
  3. Contrast: Black on white provides best results. IronQR's styling features allow creative variations while maintaining readability.
  4. Size: Ensure minimum 2cm x 2cm for printed codes. Digital displays may need larger sizes based on viewing distance.

How Do I Handle Different Use Cases?

Different applications require different approaches:

For Business Cards and Print Materials:

// High error correction for durability
QrOptions printOptions = new QrOptions(QrErrorCorrectionLevel.High, 10);
QrCode businessCard = QrWriter.Write("BEGIN:VCARD\nVERSION:3.0\nFN:John Doe\nEND:VCARD", printOptions);

For Digital Displays and Websites:

// Medium error correction with larger modules for screen display
QrOptions digitalOptions = new QrOptions(QrErrorCorrectionLevel.Medium, 15);
QrCode webQr = QrWriter.Write("https://example.com", digitalOptions);

For Mobile Applications:

// Optimized for mobile scanning
QrOptions mobileOptions = new QrOptions(QrErrorCorrectionLevel.Low, 8);
QrCode appQr = QrWriter.Write("myapp://action", mobileOptions);

Advanced Features and Integration

IronQR's comprehensive features extend beyond basic QR code generation. The library integrates seamlessly with other Iron Software products and supports batch processing, dynamic generation, and web application integration.

For complete QR code solutions, explore our C# QR Code Generator tutorial covering end-to-end implementation patterns and enterprise best practices.

IronQR provides the tools and flexibility for professional .NET development, from simple generators to complex document processing systems. The library's cross-platform compatibility ensures consistent QR code generation across Windows, Linux, macOS, and cloud environments.

Frequently Asked Questions

How can I generate a QR code image using IronQR in C#?

To create a QR code image in C#, you can use IronQR's `QrWriter.Write()` method to generate the QR code, and then the `Save()` method to get an `AnyBitmap` object. You can then use the `SaveAs()` method to export the QR code into your preferred image format like PNG or JPEG.

What are the steps to create my first QR code image with IronQR?

To create your first QR code using IronQR, install IronQR via NuGet, add `using IronQr;`, generate a QR code object with `QrCode qrCode = QrWriter.Write("your text");`, save it to a bitmap with `AnyBitmap anyBitmap = qrCode.Save();`, and export the image using `anyBitmap.SaveAs("myQRCode.png");`.

Which image formats are supported for exporting QR codes with IronQR?

IronQR allows exporting QR codes in multiple image formats including PNG, JPEG, BMP, GIF, TIFF, WBMP, WebP, Icon, WMF, and RawFormat.

Why is PNG preferred over JPEG for QR code images?

PNG is preferred over JPEG for QR codes because it provides lossless compression, which maintains sharp edges essential for readability. JPEG's lossy compression can cause blurring and affect the QR code's scannability.

How do I adjust the size and quality of a QR code generated with IronQR?

IronQR allows you to control QR code size and quality using `QrOptions` for error correction levels and dimensions. For example, set custom dimensions by creating a QR code with `QrOptions options` and use `qrCode.Save()` with `QrStyleOptions` to define the size.

What types of QR codes does IronQR support?

IronQR supports various QR code types including the standard QRCode, MicroQRCode for space-limited applications, and RMQRCode for rectangular spaces, accommodating diverse application needs.

What are some best practices for generating QR code images for production use?

Best practices include using a high error correction level for printed materials, maintaining a white quiet zone around the QR code, ensuring high contrast, and setting an appropriate size to ensure scan reliability.

Which QR code type should I use for a small label?

For small labels, MicroQR codes are ideal due to their compact size. They are designed for space-limited applications and can store up to 35 numeric or 21 alphanumeric characters.

Can I create styled QR codes with IronQR?

Yes, with IronQR you can create styled QR codes offering options for advanced customization, including custom dimensions, error correction levels, and integrating logos or custom colors.

Does IronQR integrate with other Iron Software products?

Yes, IronQR integrates seamlessly with other Iron Software products, supporting batch processing, dynamic generation, web application integration, and more for comprehensive .NET development.

Curtis Chau
Technical Writer

Curtis Chau holds a Bachelor’s degree in Computer Science (Carleton University) and specializes in front-end development with expertise in Node.js, TypeScript, JavaScript, and React. Passionate about crafting intuitive and aesthetically pleasing user interfaces, Curtis enjoys working with modern frameworks and creating well-structured, visually appealing manuals.

...
Read More

Ready to Get Started?

Nuget Downloads 74,386Version:2026.9just released

Get your free 30-day Trial Key instantly.
No credit card or account creation required
C# NuGet Library for PDF
Install with NuGet

Version: 2026.9

PM > Install-Package IronQR
nuget.org/packages/IronQR/
  1. In Solution Explorer, right-click References, Manage NuGet Packages
  2. Select Browse and search "IronQR"
  3. Select the package and install
C# PDF DLL
Download DLL

Version: 2026.9

  1. Download and unzip IronQR to a location such as ~/Libs within your Solution directory
  2. In Visual Studio Solution Explorer, right click References. Select Browse, "IronQR.dll"

Licenses from $999

Key in blue circle

Get your free 30-day Trial Key instantly.

Your trial license will be sent to your email address

No limitations. 100% unlocked. No credit card.

bullet_checkedNo credit card or account creation requiredNo limitations. 100% unlocked. No credit card.
  • Logo Aetna
  • Logo NASA
  • Logo GE
  • Logo Porsche
  • Logo USDA
  • Logo Qatar
Join Millions of Engineers who’ve tried IronPDF
Book your free Live Demo
Booking Badge

Trusted by Millions of Engineers Worldwide

Iron Software's customer logos
Get Your No-Obligation Consult
Complete the form below or email sales@ironsoftware.com
Your details will always be kept confidential.
Trusted by Millions of Engineers Worldwide
Iron Software's customer logos
Get your free 30-day Trial Key instantly.
No credit card or account creation required