Accusoft.BarcodeXpress7.Net Accusoft Pegasus
Acquire an Image for Barcode Recognition
See Also Send Feedback  
How To > Acquire an Image for Barcode Recognition

Glossary Item Box

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 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.

See Also

©2011. All Rights Reserved.