I have spent a lot of time searching for just a simple... getting started sample or example for using the ZXing.Net in c# (Winforms). Really no luck. The small snippet on this project's home page does not translate to anything that I can get to run/compile.
I think it would help me get a long way, if I could have the following....
Perhaps assume this is going in the Click event of a button.
I have a letter-sized image file (png) 24bit 200dpi (1700x2200). This page is blank (white) except for two simple Code39 barcodes.
I just want to know the procedure to load this file, prepare it for the ZXing reader, and decode the barcode(s), of course, accessing the decoded data in the results.
I may be just stuck on stupid, but everything I try while winging it, I hit a brick wall. I assume if I have read the image into a Bitmap, I have to convert it to an ZXing BitmapImage, and/or a Luminence object (to get to a 1-bit format)???
Haven't had any luck following the logic, or instantiating what I need. Please provide a complete sample from reading (or accessing bitmap from a System.Drawing.Bitmap), to decoding the barcodes. It will, perhaps, un-stick me from my current stupor.
May 13, 2013 at 8:28 PM
You will find a lot of samples in the source code repository:
There is also a complete WinForms demo:
You can get the complete source code (zxing.net library with sample) in the download area.
In conclusion there are only three main steps you have to do:
- load the image to a System.Drawing.Bitmap instance
var barcodeBitmap = (Bitmap)Bitmap.LoadFrom("C:\sample-barcode-image.png");
- give the bitmap to the barcode reader
- process the result
Please look into the demo applications which I mentioned above.
All you have to do is shown there.