Lyo.QRCode 1.0.3

dotnet add package Lyo.QRCode --version 1.0.3
                    
NuGet\Install-Package Lyo.QRCode -Version 1.0.3
                    
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="Lyo.QRCode" Version="1.0.3" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Lyo.QRCode" Version="1.0.3" />
                    
Directory.Packages.props
<PackageReference Include="Lyo.QRCode" />
                    
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 Lyo.QRCode --version 1.0.3
                    
#r "nuget: Lyo.QRCode, 1.0.3"
                    
#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 Lyo.QRCode@1.0.3
                    
#: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=Lyo.QRCode&version=1.0.3
                    
Install as a Cake Addin
#tool nuget:?package=Lyo.QRCode&version=1.0.3
                    
Install as a Cake Tool

Lyo.QRCode

QR code generation and reading for Lyo: IQRCodeService, QRCodeBuilder, ISO Model 2 encoding in-box (BuiltInQRCodeService), optional QRCoder adapter package Lyo.QRCode.QRCoder, and typed payload helpers (Lyo.QRCode.Payloads) for Wi‑Fi, URLs, vCard, mailto:, etc.

Examples

Quick start (built-in encoder)

using Lyo.QRCode;
using Lyo.QRCode.Models;
using Microsoft.Extensions.DependencyInjection;

var services = new ServiceCollection();
services.AddQRCodeService(o => {
    o.DefaultSize = 16; // pixels per module, not total width
    o.DefaultFormat = QRCodeFormat.Png;
    o.DefaultErrorCorrectionLevel = QRCodeErrorCorrectionLevel.Medium;
});

var qr = services.BuildServiceProvider().GetRequiredService<IQRCodeService>();
var result = await qr.GenerateAsync("https://example.com");

if (result.IsSuccess && result is QRCodeResult r && r.ImageBytes != null)
    await File.WriteAllBytesAsync("qr.png", r.ImageBytes);

Typed payload (Wi‑Fi example)

using Lyo.QRCode;
using Lyo.QRCode.Payloads;

var payload = new WifiQrPayload("MySSID", "secret", QrWifiSecurityType.Wpa);
var (_, opts) = QRCodeBuilder.New()
    .WithPayload(payload)
    .WithFormat(QRCodeFormat.Png)
    .WithSize(12)
    .Build();

Architecture

Piece Role
IQRCodeService Generate to memory, stream, file; batch; ReadFromImageAsync (ZXing).
BuiltInQRCodeService In-library PNG/SVG rasterization; no QRCoder NuGet for encode. JPEG/BMP not supported here (platform / format limits).
Lyo.QRCode.QRCoder Optional QRCoderQRCodeService + AddQRCoderQrCodeService for JPEG/Bitmap on Windows and QRCoder-based render path.
QRCodeBuilder Fluent QRCodeOptions + WithData / WithPayload(IQrPayload).
Payloads IQrPayload, QrPayloadKind, WifiQrPayload, HttpUrlPayload, contacts, URI schemes, messaging URLs — all serialize to the string passed to GenerateAsync.

Optional: QRCoder package

Add project/package reference to Lyo.QRCode.QRCoder and call AddQRCoderQrCodeService (or AddQRCoderQrCodeServiceFromConfiguration) instead of or in addition to * *AddQRCodeService**, depending on how you register IQRCodeService.

Payload helpers (Lyo.QRCode.Payloads)

  • Wi‑Fi (WifiQrPayload) — Omits H: when the SSID is not hidden (better phone compatibility than H:false). Open networks omit P (not P:;).
  • SMS (SmsPayload) — Defaults to sms: URI scheme; smsto: is opt-in (some Android SMS apps crash on long smsto: bodies). Very long URIs throw (* *MaxSmsQrUriLength**) to avoid app crashes.

Key options

  • QRCodeOptions.SizePixels per module (each black/white square), not the full image width. Total size ≈ module count per side × Size (decoration applied separately may grow that further).
  • QRCodeOptions.IconHint only for the encoder: the only field consumed is IconSizePercent, which bumps the effective ECC level so a planned center logo doesn't break scanning. IconBytes, IconFilePath, and DrawIconBorder are metadata for the consumer's overlay call — the QR encoder never composites the icon. Apply the actual overlay (and any frame/caption/padding) post-generation through Lyo.Images.IImageDecorationService (see migration note below).

Key options — Migration: decoration moved out of the encoder

QRCodeOptions.Frame, QRCodeBuilder.WithFrame(...), and the optional IImageService / IQrFrameLayoutService constructor parameters on BuiltInQRCodeService are gone. Compose icons and chrome on the returned bytes with Lyo.Images:

using Lyo.Images;
using Lyo.Images.Builders;
using Lyo.Common.Enums;

var qr = await qrService.GenerateAsync(data, options);
var qrBytes = ((QRCodeResult)qr).ImageBytes!;

var decorated = await decoration.Pipeline(qrBytes)
    .Overlay(logoBytes, b => b.WithOverlaySizePercent(18).WithPadColor("#FFFFFF").WithBorder("#000000"))
    .AddCaption(b => b.WithText("Scan Me").WithNotch())
    .AddOuterPadding(b => b.WithPanelColor("#FFFFFF").WithCornerRadius(16))
    .AddFrame(b => b.WithStrokeColor("#1e293b").WithStrokeWidth(2).WithCornerRadius(16))
    .ToByteArrayAsync(ImageFormat.Png);

OverlayAsync works on PNG (raster) and SVG (embeds a base64 PNG <image> before </svg>); the other primitives require raster input.

Error correction

QRCodeErrorCorrectionLevel: Low (~7%), Medium (~15%), Quartile (~25%), High (~30%) recovery. Higher levels tolerate damage and logos better but increase symbol version for the same payload.

Blazor UI (optional)

Dependencies

Generated from ProjectReference / PackageReference (same model as docs/Lyo.ProjectGraph.html).

  • Lyo.Common — (direct, lyo)
  • Lyo.Exceptions — (direct, lyo)
  • Lyo.Metrics — (direct, lyo)
  • Lyo.Result — (direct, lyo)
  • Microsoft.Extensions.Configuration.Binder 10.0.5 — (direct, microsoft)
  • Microsoft.Extensions.DependencyInjection.Abstractions 10.0.5 — (direct, microsoft)
  • Microsoft.Extensions.Logging.Abstractions 10.0.5 — (direct, microsoft)
  • SixLabors.ImageSharp 3.1.12 — (direct, third-party)
  • ZXing.Net 0.16.11 — (direct, third-party)
  • ZXing.Net.Bindings.ImageSharp.V3 0.16.18 — (direct, third-party)
  • Microsoft.Extensions.Options.ConfigurationExtensions 10.0.5 — (transitive, microsoft)
  • System.Memory 4.6.3 — (transitive, microsoft, netstandard2.0)
  • System.Text.Json 10.0.5 — (transitive, microsoft, netstandard2.0)
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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on Lyo.QRCode:

Package Downloads
Lyo.QRCode.Web.Components

Reusable Blazor components for QR code generation and preview workflows.

Lyo.QRCode.QRCoder

QRCoder implementation for Lyo.QRCode - QR code generation service using QRCoder library.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.3 0 8/19/2026
1.0.2 0 8/19/2026
1.0.1 41 8/18/2026
1.0.0 96 8/16/2026