Repository navigation
Replies: 2 comments
|
Sorry, but this lib is aim to create QR code, but not decode. |
0 replies
|
Starting SkiaSharp.QrCode, It supported decode QRCode. Here's sample code to decode without System.Drawing. // From QRCodeData (e.g. round-trip validation)
var qrData = QRCodeGenerator.CreateQrCode("content", ECCLevel.M);
if (QRCodeDecoder.TryDecode(qrData, out var text))
{
Console.WriteLine(text); // "content"
}
// From an image
using var bitmap = SKBitmap.Decode("qr.png");
if (QRCodeDecoder.TryDecode(bitmap, out var text, out var info))
{
Console.WriteLine($"{text} (version {info.Version}, ECC {info.EccLevel}, {info.ErrorsCorrected} errors corrected)");
}
// Zero-allocation: span in, span out
Span<char> destination = stackalloc char[QRCodeDecoder.GetMaxDecodedLength(version)];
if (QRCodeDecoder.TryDecode(moduleSpan, size, destination, out var written, out _))
{
var text = destination.Slice(0, written); // no heap allocation
} |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
I am using your code in project in .NET7 hybrid blazor app. I can make the QR Code image but I cannot decode it.
All reactions