ImageGear for C and C++ on Windows v19.0
IG_fltr_load_file

This function loads an image from the specified file into memory and creates a HIGEAR handle for this image.

Declaration:

 
Copy Code
AT_ERRCOUNT ACCUAPI IG_fltr_load_file(
   const LPSTR lpszFileName,
   UINT nPage,
   LPHIGEAR lphIGear
);

Arguments:

Name Type Description
lpszFileName const LPSTR Path and name of the file to load. The path can be absolute or relative.
nPage UINT Page number to load if this is a multi-page file. Note that page numbers begin at 1, not 0. Set nPage to 1 if this is not a multi-page file.
lphIGear LPHIGEAR Pointer to the HIGEAR object in which to return the ImageGear handle of the image.

Return Value:

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

Supported Raster Image Formats:

All pixel formats supported by ImageGear for C and C++.

Sample:

Color, Display, Image Processing

Remarks:

The handle that ImageGear assigns for this image is returned in the hIGear argument. The file named by szFileName may be in any format recognized by ImageGear. The function will determine the format by inspecting the file's header section.

Example:

 
Copy Code
HIGEAR    hIGear;        // Will hold handle returned by IG_fltr_load_file
AT_ERRCOUNT nErrCount;    // Count of errs on stack upon ret from func*/
// Load the selected image
nErrCount = IG_fltr_load_file("picture.tif", 1, &hIGear);
if(nErrCount == 0)
{
    // ...

    // Delete the image
    IG_image_delete(hIGear);
}

  • Some file formats, such as TXT (ASCII Text), JPEG, and others, may be loaded with additional control, using IG_fltr_ctrl_get and IG_fltr_ctrl_set. See the description of these functions also in Loading and Saving section.
  • Note that simply loading the file does not cause it to be displayed. Refer to IG_dspl_image_draw and related routines, for how to display an image once it is in memory. See also IG_load_file_display.
  • This function can also be used to load Internet files. See the example code below. The function IG_load_internet is a more versatile function for loading Internet files.

See also the section Loading Images.

 

 


©2017. Accusoft Corporation. All Rights Reserved.

Send Feedback