0

This barcode:

Sample Barcode

Will not decode. What is wrong with that image that it will not decode.

string barcodePng = "tmp.png";
reader = new BarcodeReader();
reader.Options.PossibleFormats = new List<BarcodeFormat>();
reader.Options.PossibleFormats.Add(BarcodeFormat.CODE_39);
reader.Options.TryHarder = true;
using (var barcodeBitmap = new Bitmap(barcodePng))
{
    var result = reader.Decode(barcodeBitmap);
    if (result != null)
    {
        Console.WriteLine("barcode did not decode");
    }
}

This one is different from other thousands of other images that did decode in that I had to repair the original .tif file that it was cut from because it was damaged. I repaired it by converting it to .pdf and back to .tif.

Be Kind To New Users
  • 9,672
  • 13
  • 78
  • 125

1 Answers1

1

What is wrong with that image that it will not decode.

It will not decode because some bars have merged and/or changed their widths due to low resolution and blurring.

Assuming the symbology is Code 39, the valid barcode looks like this:

GSerg
  • 76,472
  • 17
  • 159
  • 346