Nicomsoft OCR: Developer's Guide


Img_SaveToMemory


Syntax

C++:int Img_SaveToMemory(HIMG ImgObj, char* Buffer, int BufferSize, int Format, int Flags)
C#:int Img_SaveToMemory(int ImgObj, out System.Array Bytes, int Format, int Flags)
Visual Basic:Function Img_SaveToMemory(ByVal ImgObj As Integer, ByRef Bytes As System.Array, ByVal Format As Integer, ByVal Flags As Integer) As Integer
Java:int Img_SaveToMemory(HIMG ImgObj, byte[] Bits, int Format, int Flags)
Delphi:function Img_SaveToMemory(ImgObj:HIMG; Buffer:pointer; BufferSize:integer; Format:integer; Flags:integer):integer


Description

Saves the current image assigned to the Image or Block object to a memory buffer. 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.


Parameters

ImgObj [IN] – the Image object. You can also specify the Block object to save only a part of the image.
Buffer [IN] – a pointer to the buffer that will contain the image after saving.
BufferSize [IN] – the buffer size in bytes. To get a buffer size sufficient for storing the image, specify 0.
Format [IN] – the destination image file format. See the IMG_FORMAT_XXXXX constants for possible values.
Flags [IN] – for the default options, specify 0; for the JPEG format, you can also specify the quality level (1 ... 100).


Return value

Zero if success, otherwise an error code. If the "BufferSize" parameter is zero, the returned value is the buffer size in bytes that is necessary to store the image.


Remarks

None.


Example

None.