public string DecodeQrImage(string fileName) { System.Drawing.Image img = System.Drawing.Image.FromFile(fileName); Bitmap bmap = new Bitmap(img); LuminanceSource source = new RGBLuminanceSource(bmap, bmap.Width, bmap.Height); BinaryBitmap bitmap = new BinaryBitmap(new HybridBinarizer(source)); Result result = new MultiFormatReader().Decode(bitmap); return result.Text; }
public string DecodeQrImage(string fileName) { System.Drawing.Image img = System.Drawing.Image.FromFile(fileName); Bitmap bmap = new Bitmap(img); LuminanceSource source = new RGBLuminanceSource(bmap, bmap.Width, bmap.Height); BinaryBitmap bitmap = new BinaryBitmap(new HybridBinarizer(source)); Result result = new MultiFormatReader().Decode(bitmap); return(result.Text); }