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

This function loads a raw (no header) image data file from disk.

Declaration:

 
Copy Code
AT_ERRCOUNT ACCUAPI IG_load_raw_file(
   const LPSTR lpszFileName,
   LONG lOffset,
   AT_DIMENSION nWidth,
   AT_DIMENSION nHeight,
   UINT nBitsPerPixel,
   AT_MODE nFillOrder,
   AT_MODE nCompression,
   LPHIGEAR lphIGear
);

Arguments:

Name Type Description
lpszFileName const LPSTR Name of the file.
lOffset LONG Offset in the file from where the raw image data starts.
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 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

AT_ERRCOUNT nErrcount;  /* Returned count of errors */
nErrcount = IG_load_raw_file("Group4.raw", 0, 2320, 3408, 1, IG_FILL_MSB, IG_COMPRESSION_CCITT_G4, &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 offset to the start of the pixel data, 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.

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.