Nicomsoft OCR: Developer's Guide


Img_LoadFromMemory


Syntax

C++:int Img_LoadFromMemory(HIMG ImgObj, unsigned char* Bytes, int DataSize)
C#:int Img_LoadFromMemory(int ImgObj, ref System.Array Bytes, int DataSize)
Visual Basic:Function Img_LoadFromMemory(ByVal ImgObj As Integer, ByRef Bytes As System.Array, ByVal DataSize As Integer) As Integer
Java:int Img_LoadFromMemory(HIMG ImgObj, byte[] Bytes, int DataSize)
Delphi:function Img_LoadFromMemory(ImgObj:HIMG; Bytes:PBYTE; DataSize:integer):integer


Description

Loads an image located in the memory to the Image object. The free, open-source FreeImage library is used to support a wide range of image formats. Please refer to its documentation for a full list of supported image formats. This function is essentially the same as the Img_LoadFile function, but works with the memory instead of a file.


Parameters

ImgObj [IN] – the Image object.
Bytes [IN] – a pointer to the byte array that contains the image.
DataSize [IN] – the size of the image, in bytes.


Return value

Zero if success, otherwise an error code.


Remarks

This function loads a picture stored in an image format (BMP, JPEG, PNG, etc.) from the memory. If you want to load raw RGB bitmap data, use the Img_LoadBmpData function instead.


Example

See the sample projects in the NSOCR SDK.