Meziantou.Framework.QRCode.Imaging 1.0.0

Prefix Reserved
dotnet add package Meziantou.Framework.QRCode.Imaging --version 1.0.0
                    
NuGet\Install-Package Meziantou.Framework.QRCode.Imaging -Version 1.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Meziantou.Framework.QRCode.Imaging" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Meziantou.Framework.QRCode.Imaging" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Meziantou.Framework.QRCode.Imaging" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Meziantou.Framework.QRCode.Imaging --version 1.0.0
                    
#r "nuget: Meziantou.Framework.QRCode.Imaging, 1.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Meziantou.Framework.QRCode.Imaging@1.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Meziantou.Framework.QRCode.Imaging&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Meziantou.Framework.QRCode.Imaging&version=1.0.0
                    
Install as a Cake Tool

Meziantou.Framework.QRCode.Imaging

Renders the QR codes and barcodes of Meziantou.Framework.QRCode as Meziantou.Framework.Imaging images. The resulting Image<Rgba32> can be saved in any format the library supports (PNG, WebP, JPEG, GIF, AVIF, ...), resized, or drawn onto another image.

Meziantou.Framework.QRCode already writes PNG files on its own (ToPng), with no dependency. Use this package when you need another format or want to process the image further.

Usage

using Meziantou.Framework;
using Meziantou.Framework.Imaging;
using Meziantou.Framework.Imaging.Formats;

var qrCode = QRCode.Create("https://www.meziantou.net", ErrorCorrectionLevel.M);

// Default options: 10 pixels per module, a 4-module quiet zone, black on white
using var image = qrCode.ToImage();
image.Save("qrcode.webp", new WebPEncoder());

// Custom options
using var customImage = qrCode.ToImage(new QRCodeImageOptions
{
    ModuleSize = 4,
    QuietZoneModules = 2,
    DarkColor = new Rgba32(0x00, 0x33, 0x66),
    LightColor = Colors.Transparent,
});

// An indexed PNG stores the two colors in a palette, as ToPng does
customImage.Save("qrcode.png", new PngEncoder { PixelLayout = PngPixelLayout.Indexed });

Barcodes work the same way:

var barcode = Barcode.CreateEan13("5901234123457");
using var image = barcode.ToImage(new BarcodeImageOptions { ModuleWidth = 3, ModuleHeight = 100 });

Drawing a QR code onto an existing image:

using var ticket = Image.Load<Rgba32>("ticket.png");
using var qrCodeImage = QRCode.Create("TICKET-0042").ToImage(new QRCodeImageOptions { ModuleSize = 4 });
ticket.Draw(canvas => canvas.DrawImage(qrCodeImage.Frames[0], new PointD(16, 16)));
ticket.Save("ticket-with-qrcode.png");

Options

QRCodeImageOptions Default Description
ModuleSize 10 Size of each module, in pixels
QuietZoneModules 4 Number of quiet zone modules around the QR code
DarkColor Colors.Black Color of dark modules
LightColor Colors.White Color of light modules and of the quiet zone
BarcodeImageOptions Default Description
ModuleWidth 2 Width of each module, in pixels
ModuleHeight 80 Height of each module, in pixels
QuietZoneModules 10 Number of quiet zone modules on the left and right sides
DarkColor Colors.Black Color of dark modules
LightColor Colors.White Color of light modules and of the quiet zone
Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed.  net11.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0 43 10/17/2026