title: C# with ZXing.Net: Decoding the QR code
body: <p>I'm new to <strong>C#</strong> and got problem with <strong>QR code</strong> decoding using <strong>ZXing.Net</strong>. The application launches with no errors, but I get nothing in the result string. I think the problem could be in <strong>RGBLuminanceSource()</strong>.</p>
  
  <pre><code>private static byte[] ToByteArray(Image img)
  {
      byte[] byteArray = new byte[0];
      using (MemoryStream stream = new MemoryStream())
      {
          img.Save(stream, System.Drawing.Imaging.ImageFormat.Bmp);
          stream.Close();
  
          byteArray = stream.ToArray();
      }
      return byteArray;
  }
  private void button1_Click(object sender, EventArgs e)
  {
      *** SOME OTHER CODE HERE ***
  
      Bitmap BitmapImage = new Bitmap(@"D:\1.png"); 
  
      QRCodeReader reader = new QRCodeReader();
      LuminanceSource source = new RGBLuminanceSource(ToByteArray(BitmapImage), BitmapImage.Width, BitmapImage.Height);
  
      var binarizer = new HybridBinarizer(source);
      var binBitmap = new BinaryBitmap(binarizer);
      string result = reader.decode(binBitmap).Text;
  
      *** SOME OTHER CODE HERE ***
  }
  </code></pre>