Dear all,
I have a troubles to start with ZXing library usage
Please, if someone could check my piece of code...
Or if you can past some example in VB .NET ...
(basically I`m stopped on convert of Bitmap to Byte array , as it seems...
result of this is index out of range in zxing.dll
Thanks a lot
code:
I have a troubles to start with ZXing library usage
Please, if someone could check my piece of code...
Or if you can past some example in VB .NET ...
(basically I`m stopped on convert of Bitmap to Byte array , as it seems...
result of this is index out of range in zxing.dll
Thanks a lot
code:
Imports ZXing
Imports ZXing.QrCode
Public Class Form1
Public Shared Function ConvertToByteArray(ByVal value As Bitmap) As Byte()
Dim bitmapBytes As Byte()
Using stream As New System.IO.MemoryStream
value.Save(stream, value.RawFormat)
bitmapBytes = stream.ToArray
End Using
Return bitmapBytes
End Function
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim readCode As New ZXing.QrCode.QRCodeReader()
Dim imageFile As New Bitmap("C:\qr2.jpg")
Dim Lumin As New RGBLuminanceSource(ConvertToByteArray(imageFile), imageFile.Width, imageFile.Height)
Dim HBin As New ZXing.Common.HybridBinarizer(Lumin)
Dim Bitm As New ZXing.BinaryBitmap(HBin)
Dim result = readCode.decode(Bitm)
End Sub
End Class