title: ZXing .Net - Unable to decode/read any barcodes in images
body: <p>I am trying to use ZXing .Net to decode barcodes in images taken from a camera but it is not working for any image I try.</p>
  <p>Here's the code I'm currently using:</p>
  <pre><code>protected void ReadBarcodeZXing(string imagePath)
  {
      BarcodeReader reader = new BarcodeReader()
      {
          Options =
              {
                  TryHarder = true,
                  ReturnCodabarStartEnd = false,
                  PureBarcode = false
              }
      };
  
      Bitmap barcodeBitmap = (Bitmap)Bitmap.FromFile(imagePath);
  
      var result = reader.Decode(barcodeBitmap);
  
      if (result != null)
          lblResult.Text = result.BarcodeFormat.ToString() + &quot;&lt;br /&gt;&quot; + result.Text;
      else
          lblResult.Text = &quot;No barcodes found in image&quot;;
  
      barcodeBitmap.Dispose();
  }
  </code></pre>
  <p>I've tried with AutoRotate and TryInverted set to true and I've tried using PossibleFormats.</p>
  <p>Here are some barcode images I've tried decoding:</p>
  <blockquote>
  <p>1: <a href="https://imgur.com/yPkDNRM" rel="nofollow noreferrer">https://imgur.com/yPkDNRM</a></p>
  <p>2: <a href="https://imgur.com/bNKzh73" rel="nofollow noreferrer">https://imgur.com/bNKzh73</a> (Close-up of #1)</p>
  <p>3: <a href="https://imgur.com/DJ1lcAa" rel="nofollow noreferrer">https://imgur.com/DJ1lcAa</a></p>
  <p>4: <a href="https://imgur.com/Q3nN6Do" rel="nofollow noreferrer">https://imgur.com/Q3nN6Do</a></p>
  <p>5: <a href="https://imgur.com/e8JbpmV" rel="nofollow noreferrer">https://imgur.com/e8JbpmV</a> (Close-up of #4)</p>
  <p>6: <a href="https://imgur.com/pCEj9Iu" rel="nofollow noreferrer">https://imgur.com/pCEj9Iu</a></p>
  <p>7: <a href="https://imgur.com/Q3qlVDP" rel="nofollow noreferrer">https://imgur.com/Q3qlVDP</a></p>
  </blockquote>
  <p>#6 &amp; #7 are sample images provided on the <a href="https://github.com/micjahn/ZXing.Net" rel="nofollow noreferrer">GitHub project</a>. There were more samples that didn't work but many of them <strong>did</strong> work.</p>
  <p>Anyone able to help me get it working properly? Or help me understand why it's not working for my own images?</p>