title: How to Read barcode image in Xamarin forms
body: <p>I am trying to read the text from a QRcode image on my mobile app. I am using Xamarin.Forms with ZXing NuGet package.</p>
  <p>I have been able to get the file using <code>Xamarin.Essentials FilePicker</code>. But I don't know how to actually read the barcode. I have looked at some stackoverflow solutions and they all seem to be Xamarin.Android based (using BinaryBitmap objects). I need a solution that can work for iOS and UWP as well. Here is what I have so far:</p>
  <pre><code>string file = &quot;&quot;;
  var filePickerOptions = new PickOptions
  {
      PickerTitle = &quot;Select Barcode Image&quot;,
      FileTypes = FilePickerFileType.Images
  };
  var result = await FilePicker.PickAsync(filePickerOptions);
  if (result != null)
  {
      file = result.FullPath;
      var res = Decode(file, BarcodeFormat.QR_CODE);
      Console.WriteLine(res.Text);
  }
  
  
  public Result Decode(string file, BarcodeFormat? format = null, KeyValuePair&lt;DecodeHintType, object&gt;[] aditionalHints = null)
  {
      var r = GetReader(format, aditionalHints);
      /* I need some function here that will allow me to get the BinaryBitmap from the image file path or something along those lines.*/
      var image = GetBinaryBitmap(file);
      var result = r.decode(image);
      return result;
  }
  
  MultiFormatReader GetReader(BarcodeFormat? format, KeyValuePair&lt;DecodeHintType, object&gt;[] aditionalHints)
  {
      var reader = new MultiFormatReader();
  
      var hints = new Dictionary&lt;DecodeHintType, object&gt;();
  
      if (format.HasValue)
      {
          hints.Add(DecodeHintType.POSSIBLE_FORMATS, new List&lt;BarcodeFormat&gt;() { format.Value });
      }
      if (aditionalHints != null)
      {
          foreach (var ah in aditionalHints) 
          {
              hints.Add(ah.Key, ah.Value);
          }
      }
  
      reader.Hints = hints;
  
      return reader;
  }
  
  </code></pre>