Oscore.QrCodes 1.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 Oscore.QrCodes --version 1.0.4
NuGet\Install-Package Oscore.QrCodes -Version 1.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="Oscore.QrCodes" Version="1.0.4" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Oscore.QrCodes --version 1.0.4
#r "nuget: Oscore.QrCodes, 1.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 Oscore.QrCodes as a Cake Addin
#addin nuget:?package=Oscore.QrCodes&version=1.0.4

// Install Oscore.QrCodes as a Cake Tool
#tool nuget:?package=Oscore.QrCodes&version=1.0.4

QrCodes

Nuget package CI/CD License: MIT

Modern and efficient cross-platform QR code generation, rendering and serialization.
qr

🔥 Features 🔥

  • Use SkiaSharp/ImageSharp instead of System.Drawing to be cross-platform.
  • Support latest dotnet versions.
  • Supports trimming/NativeAOT.
  • Generate QR code with logo image.
  • Allows many different styles.
  • Supports many predefined payloads:
    • BezahlCode
    • Bitcoin like address
    • Bookmark
    • CalendarEvent
    • ContactData
    • Geolocation
    • Girocode
    • Mail
    • MMS
    • MoneroTransaction
    • OneTimePassword
    • PhoneNumber
    • ShadowSocksConfig
    • SkypeCall
    • SloveniaUpnQR
    • SMS
    • SwissQRCode
    • Url
    • WhatsAppMessage
    • Telegram
    • Wi-Fi
  • Supports next renderers
    • Ascii
    • Base64
    • SVG
    • PostScript
    • PDF
    • FastPngRenderer - fast but not support all features
    • Bitmap(.bmp) - fast but not support all features
    • ImageSharp - powerful, allows many features and export formats
    • SkiaSharp - powerful, allows many features and export formats
    • System.Drawing - legacy, only windows, not support all features
  • Supports helpers for MAUI
    • QrCodeSource - ImageSource to produce QR code
    • QrCodeExtension markup extension - Simplifies usage of QrCodeSource

Usage

// Base library with all payloads and some renderers(Ascii, Base64, Pdf, FastBitmap, FastPng, SVG, PostScript)
dotnet add package Oscore.QrCodes

// SkiaSharpRenderer(Gif, Jpeg, Png, WebP, Bmp, Ico, Wbmp, Pkm, Ktx, Astc, Dng, Heif, Avif)
dotnet add package Oscore.QrCodes.SkiaSharp
// ImageSharpRenderer(Gif, Jpeg, Png, WebP, Bmp, Pbm, Tga, Tiff)
dotnet add package Oscore.QrCodes.ImageSharp
// SystemDrawingRenderer(Gif, Jpeg, Png, Bmp, Tiff)
dotnet add package Oscore.QrCodes.System.Drawing

// MAUI helpers(QrCodeSource and QrCodeExtension markup extension). Uses SkiaSharpRenderer.
dotnet add package Oscore.QrCodes.Maui
Generate QR code
var qrCode = QrCodeGenerator.Generate(
    plainText: new Mail(email: "hello@oscore.io").ToString(),
    eccLevel: ErrorCorrectionLevel.High);
using var pngBytes = SkiaSharpRenderer.RenderToBytes(
    data,
    settings: new RendererSettings
    {
        DarkColor = Color.Red,
    });
Generate ImageSource for MAUI

You can test all variants using QrCodes.SampleApp MAUI app

xmlns:qr="clr-namespace:QrCodes.Maui;assembly=QrCodes.Maui"
<Image Source="{qr:QrCode 'https://oscore.io/'}" />

Benchmarks

You can view the reports for each version here


BenchmarkDotNet v0.13.12, macOS Sonoma 14.2.1 (23C71) [Darwin 23.2.0]
Apple M1 Pro, 1 CPU, 10 logical and 10 physical cores
.NET SDK 8.0.100
  [Host]     : .NET 8.0.0 (8.0.23.53103), Arm64 RyuJIT AdvSIMD
  DefaultJob : .NET 8.0.0 (8.0.23.53103), Arm64 RyuJIT AdvSIMD

Categories=Renderers  

Method Mean Ratio Gen0 Gen1 Gen2 Allocated Alloc Ratio
SkiaSharpRenderer_Png 1,065.14 μs 1.00 - - - 1.52 KB 1.00
SkiaSharpRenderer_Jpeg 331.18 μs 0.31 1.9531 - - 13.23 KB 8.72
SkiaSharpRenderer_Bmp NA ? NA NA NA NA ?
ImageSharpRenderer_Png 417.70 μs 0.40 1.9531 0.4883 - 48.1 KB 31.71
ImageSharpRenderer_Jpeg 297.34 μs 0.28 9.7656 1.4648 0.4883 57.02 KB 37.60
ImageSharpRenderer_Bmp 67.90 μs 0.06 79.2236 44.5557 43.3350 363.08 KB 239.40
FastPngRenderer_ 43.58 μs 0.04 0.8545 - - 5.39 KB 3.56
BitmapRenderer_ 519.42 μs 0.49 219.7266 219.7266 36.1328 368.75 KB 243.15
SvgRenderer_ 41.03 μs 0.04 8.9111 - - 54.95 KB 36.23

Benchmarks with issues: Benchmarks.SkiaSharpRenderer_Bmp: DefaultJob

It was forked from the QRCoder-ImageSharp project.
QRCoder is a project by Raffael Herrmann and was first released in 10/2013.
QRCoder-ImageSharp is a project by Joerg Plenert.
It's licensed under the MIT license.

Disclaimer

Although the library includes many things, we only use and support QrCodes/SkiaSharp/Maui functionality.
But we will be happy to accept your PR regarding ImageSharp/SystemDrawing/WPF/other renderers.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 is compatible.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (4)

Showing the top 4 NuGet packages that depend on Oscore.QrCodes:

Package Downloads
Oscore.QrCodes.ImageSharp The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org.

Modern cross-platform QR code generation, rendering and serialization.

Oscore.QrCodes.Maui The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org.

Modern cross-platform QR code generation, rendering and serialization.

Oscore.QrCodes.SkiaSharp The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org.

Modern cross-platform QR code generation, rendering and serialization.

Oscore.QrCodes.System.Drawing The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org.

Modern cross-platform QR code generation, rendering and serialization.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.4 429 3/18/2024
1.0.3 149 1/31/2024
1.0.2 845 1/29/2024
1.0.0 180 1/25/2024
0.9.3 159 1/25/2024
0.9.2 2,929 1/18/2024
0.9.1 97 1/17/2024
0.9.0 106 1/17/2024