ImageGear for C and C++ on Windows v19.10 - Updated
IG_load_raw_mem
API Reference Guide > Core Component API Reference > Core Component Functions Reference > Load Functions > IG_load_raw_mem

This function loads an image from the raw image data located in the memory buffer.

Declaration:

 
Copy Code
AT_ERRCOUNT ACCUAPI IG_load_raw_mem(
   LPVOID lpImage,
   AT_UINT nSize,
   AT_DIMENSION nWidth,
   AT_DIMENSION nHeight,
   UINT nBitsPerPixel,
   AT_MODE nFillOrder,
   AT_MODE nCompression,
   LPHIGEAR lphIGear
);

Arguments:

Name Type Description
lpImage LPVOID Pointer to memory area from which to load.
nSize AT_UINT Size of image in memory.
nWidth AT_DIMENSION The width, in pixels, of the image.
nHeight AT_DIMENSION The height, in pixels, of the image.
nBitsPerPixel UINT The Bits Per Pixel of the raw data to load.
nFillOrder AT_MODE Set to the fill order used in the image: Least Significant Bit first (LSB) or Most Significant Bit first (MSB). Use one of the ImageGear - defined constants: IG_FILL_LSB or IG_FILL_MSB.
  • For G3/G4 compressed data, this parameter specifies the Least/Most significant bit.
  • For 16 bit grayscale uncompressed images, this parameter specifies the Least/Most significant byte.
  • For any other bit depths and compressions, this parameter is ignored.
nCompression AT_MODE Compression used by the RAW image data. Set to one of enumIGCompressions constants.
lphIGear LPHIGEAR Returns you a HIGEAR handle to the raw image data just loaded.

Return Value:

Returns 0 if successful. Otherwise, returns the number of ImageGear errors that occurred during this function call.

Supported Raster Image Formats:

Sample:

None

Example:

 
Copy Code
HIGEAR hIGear = 0;                // Will receive HIGEAR image handle
char* buffer = "�AAAAAAA";        // Buffer with image data
AT_DIMENSION nWidth = 2;        // Pixels per row of data to read
AT_DIMENSION nHeight = 2;        // Rows to read
AT_MODE nCompression = IG_COMPRESSION_NONE; // Compression
AT_MODE nFillOrder = IG_FILL_MSB;            // Fill order
UINT nBitsPerPixel = 16;        // Bit depth

AT_ERRCOUNT nErrcount;        /* Returned count of errors */
nErrcount = IG_load_raw_mem (buffer, (AT_UINT)strlen(buffer), nWidth, nHeight, nBitsPerPixel, nFillOrder, nCompression,
    &hIGear );

//...

// Destroy the image
if(IG_image_is_valid(hIGear))
{
    IG_image_delete(hIGear);
}

Remarks:

A raw image file contains no header or identifying information. You must supply this function with all of the information needed to correctly parse the image data, including the compression, byte fill order, width, height, and bit depth. Currently, this function can be used to read raw image data from the following types of files: ABIC, CCITT - Group 3, Group 3 2D, Group 4, LZW, and raw uncompressed data.

The ABIC and LZW compression types are available as separate components to ImageGear. See ImageGear Components for details on working with ImageGear components.

Note that lpImage must point to the start of the actual data (not to the start of any header information that may be present).

Additionally, you can specify row and pixel alignment for the loading of uncompressed images using ALIGNMENT and UNCOMPRESSED_PACKED image control parameters, respectively. See RAW format reference for more information.

For uncompressed images only, ImageGear's Load Raw functions consider the coordinates (0,0) to refer to the lower- left corner of the bitmap.