Provides QR code encoding and decoding functions.
$ dotnet add package Nerdbank.QRCodesThere are lots of options for customizing QR codes including style, image in the center, colors, and output image format. Following is a basic example.
using QRCoder;
QREncoder encoder = new();
QRCodeGenerator generator = new();
QRCodeData data = generator.CreateQrCode("https://some.url", encoder.ECCLevel);
encoder.Encode(data, "some.png", traceSource: null);
Decoding a QR code is very straightforward.
using Bitmap bitmap = (Bitmap)Image.FromFile("some.jpg");
if (QRDecoder.TryDecode(bitmap, out string? data))
{
Console.WriteLine(data);
}