Adliance.Buddy.QrCode
8.0.1.2
Prefix Reserved
dotnet add package Adliance.Buddy.QrCode --version 8.0.1.2
NuGet\Install-Package Adliance.Buddy.QrCode -Version 8.0.1.2
<PackageReference Include="Adliance.Buddy.QrCode" Version="8.0.1.2" />
paket add Adliance.Buddy.QrCode --version 8.0.1.2
#r "nuget: Adliance.Buddy.QrCode, 8.0.1.2"
// Install Adliance.Buddy.QrCode as a Cake Addin #addin nuget:?package=Adliance.Buddy.QrCode&version=8.0.1.2 // Install Adliance.Buddy.QrCode as a Cake Tool #tool nuget:?package=Adliance.Buddy.QrCode&version=8.0.1.2
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.
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 | Versions 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. |
-
net8.0
- SixLabors.ImageSharp (>= 3.1.6)
- SixLabors.ImageSharp.Drawing (>= 2.1.4)
- ZXing.Net (>= 0.16.9)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.