Code sample for image loading

During the image loading, .NET specific problems can occur.

  • The image is encapsulated in System.Drawing.Bitmap object in application memory. The bitmap data has to be transferred in byte[] array to kRecLoadImgM.

  • BitmapData.Stride is a signed number:

    Positive value means TOP_DOWN, and negative value means BOTTOM_UP. The sign of Stride is mapped into lineord of kRecSetImgFormat.

    BytesPerLine is the absolute value of Stride.

  • .NET and OmniPage SDK interprets differently the RGB order:

    • Bitmap.PixelFormat Rgb means BGR for kRecLoadImgM

    • Bitmap.PixelFormat Argb means BGRA for kRecLoadImgM

The following code sample can be used to load a bitmap image from the memory: