Adliance.Buddy.QrCode 8.0.0.4

The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org. Prefix Reserved
dotnet add package Adliance.Buddy.QrCode --version 8.0.0.4
NuGet\Install-Package Adliance.Buddy.QrCode -Version 8.0.0.4
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="Adliance.Buddy.QrCode" Version="8.0.0.4" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Adliance.Buddy.QrCode --version 8.0.0.4
#r "nuget: Adliance.Buddy.QrCode, 8.0.0.4"
#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.
// Install Adliance.Buddy.QrCode as a Cake Addin
#addin nuget:?package=Adliance.Buddy.QrCode&version=8.0.0.4

// Install Adliance.Buddy.QrCode as a Cake Tool
#tool nuget:?package=Adliance.Buddy.QrCode&version=8.0.0.4

Adliance.Buddy.QrCode

The QR Code Buddy makes generating QR Codes with images and special colors easy.

It uses the ImageSharp and the ZXing.Net libraries internally, and can be used in device and cloud scenarios.

Note: make sure to buy a license for ImageSharp, when you meet their criteria.

Example QR code

Using the library

Let's start with the most simple example:

var qrCode = new QrCodeBuilder<Rgba32>("https://adliance.net")
    .Render();
qrCode.SaveAsPng("qr-adliance.png");

Rounded

To create the same QR code, but with rounded markers and content dots just add one line:

var qrCode = new QrCodeBuilder<Rgba32>("https://adliance.net")
    .Rounded()
    .Render();
qrCode.SaveAsPng("qr-adliance.png");

Overlay image

Adding a logo image in the center is as simple as adding another line:

var qrCode = new QrCodeBuilder<Rgba32>("https://adliance.net")
    .Rounded()
    .WithOverlayImage(Image.Load("logo.png"))
    .WithOverlayMargin(2) // optional margin around the image
    .Render();
qrCode.SaveAsPng("qr-adliance.png");

Colors

The background, finder patterns and content dots are individually configurable with ImageSharp Brushes:

var finderBrush = Brushes.Solid(Color.Gold);
var backgroundBrush = Brushes.Solid(Color.Black);

var topCenter = new PointF(125, 0);
var bottomCenter = new PointF(125, 250);
var repetitionMode = GradientRepetitionMode.None;
// approximating the QR code margin by setting the color stops at 10% and 90%
var topColor = new ColorStop(0.1f, Color.Yellow);
var bottomColor = new ColorStop(0.9f, Color.LimeGreen);

var contentBrush = new LinearGradientBrush(topCenter, bottomCenter,
                repetitionMode, topColor, bottomColor);

var qrCode = new QrCodeBuilder<Rgba32>("https://adliance.net")
    .WithContentBrush(contentBrush)
    .WithFinderPatternBrush(finderBrush)
    .WithBackgroundBrush(backgroundBrush)
    .Render();
qrCode.SaveAsPng("qr-adliance.png");

Transparent background

var qrCode = new QrCodeBuilder<Rgba32>("https://adliance.net")
    .Transparent()
    .Render();
qrCode.SaveAsPng("qr-adliance-transparent.png");

QR Code settings

Other information, like the error correction level and margins can also be set:

var qrCode = new QrCodeBuilder<Rgba32>("https://adliance.net")
    .WithDimensions(500, 500)
    .WithMargin(3)
    .WithErrorCorrectionLevel(ErrorCorrectionLevel.H)
    .Render();
qrCode.SaveAsPng("qr-adliance.png");
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
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
8.0.0.4 142 4/26/2024
8.0.0.3 66 4/26/2024
8.0.0.2 65 4/26/2024
8.0.0.1 77 4/22/2024