baltermia / barcodereader-imagesharp

A barcode reader compatible with SixLabors.ImageSharp using ZXing. Trying to remove System.Drawing.Common dependencies.
MIT License
8 stars 3 forks source link

Having trouble reading Image<Rgba32> #1

Closed Lerseb closed 2 years ago

Lerseb commented 2 years ago

This is not a bug, I might not use the library properly.

Like a lot of people, I had the bad surprise to see that System.drawing is not supported by .net6 (except if you are running on Windows server). To keep the QrCode feature, I decided to go for ZXing and ImageSharp libraries and I tried to add barcodereader-imagesharp library. I figure out how to create a QrCode but I have been struggling for a long time on the reading of the QrCode.

Starting from formFile which is a IFormFile

var image = Image.Load(formFile.OpenReadStream()); var barcodeReader = new BarcodeReader.ImageSharp.BarcodeReader(true, BarcodeFormat.QR_CODE); var result = await barcodeReader.DecodeAsync(image); var str = result.ToString();

Can you please highlight what is wrong in my code? Would it be better to work byte array of the image?

Any help would be appreciated. Thanks. Sebastien

Lerseb commented 2 years ago

Finally find out ! Only Zxing.Net.Binding.sImagesharp.V2 is working "V2" is the latest library and the one that worked for me.

Hope this will help others