Acquire an Image for Barcode Recognition
Image Options
Barcode Xpress works with 1-bit black and white images, 8-bit grayscale images, and 24-bit color images. To convert other image formats use the ImagXpress ColorDepth method or other methods with the included ImagXpress component. If you use ImageGear, use the ConvertColorSpace method.
Barcode Xpress for .NET accepts .NET Bitmaps or an hDIB as an input image. Use ImagXpress or ImageGear to load images from numerous file formats and convert into the appropriate format for Barcode Xpress.
C# Example - Minimum C# code to load an image using Accusoft.ImagXpress10.Net
Copy Code
[DllImport("Kernel32.dll")]
extern private static System.IntPtr GlobalFree(System.IntPtr handle);
System.IntPtr hDib;
// Copy the hDib
hDib = image.ToHdib(false);
// Analyze the barcode
Accusoft.BarcodeXpressSdk.Result[] results = barcodeXpress.reader.Analyze(hDib);
// Free the hDib
GlobalFree(hDib);
| C# Example - Minimum C# code to load an image using Accusoft.ImagXpress10.Net | Copy Code |
|---|---|
[DllImport("Kernel32.dll")] extern private static System.IntPtr GlobalFree(System.IntPtr handle); System.IntPtr hDib; // Copy the hDib hDib = image.ToHdib(false); // Analyze the barcode Accusoft.BarcodeXpressSdk.Result[] results = barcodeXpress.reader.Analyze(hDib); // Free the hDib GlobalFree(hDib); | |
| C# Example - Minimum C# code to load an image using ImageGear .NET |
Copy Code |
|---|---|
// Load the file into an image page ImageGear.Core.ImGearPage page = ImageGear.Formats.ImGearFileFormats.LoadPage(fs, 0); // ImageGear page into a bitmap using (System.Drawing.Bitmap bm = ImageGear.Formats.ImGearFileFormats.ExportPageToBitmap(page)) { // Analyze the bitmap for barcodes Accusoft.BarcodeXpressSdk.Result[] results = barcodeXpress.reader.Analyze(bm); } | |
See the Recognize a Barcode topic for information on recognition.
See the Overview of Barcode Xpress topic for code examples on acquiring barcodes.
