使用下面的代码时我得到空值。我正在使用从 NuGet 下载的 ZXing dll
using ZXing.Common;
using ZXing.QrCode;
using ZXing.QrCode.Internal;
private void Decode()
{
Bitmap bitmap = new Bitmap(@"D:\Project\QRCodes\myqrcode.png");
try
{
MemoryStream memoryStream = new MemoryStream();
bitmap.Save(memoryStream, ImageFormat.Bmp);
byte[] byteArray = memoryStream.GetBuffer();
ZXing.LuminanceSource source = new RGBLuminanceSource(byteArray, bitmap.Width, bitmap.Height);
var binarizer = new HybridBinarizer(source);
var binBitmap = new BinaryBitmap(binarizer);
QRCodeReader qrCodeReader = new QRCodeReader();
Result str = qrCodeReader.decode(binBitmap);
}
catch{ }
}
请给我一个解决方案提前谢谢