ImageGear Professional v18.1 > API Reference Guide > Core Component API Reference > Core Component Functions Reference > Load Functions > IG_load_file |
This function loads an image from the specified file into memory and creates a HIGEAR handle for the image.
Copy Code
|
|
---|---|
AT_ERRCOUNT ACCUAPI IG_load_file(
const LPSTR lpszFileName,
LPHIGEAR lphIGear
);
|
Name | Type | Description |
lpszFileName | const LPSTR | Name of image file (you may include path with filename) to load into memory. |
lphIGear | LPHIGEAR | Pointer to HIGEAR object in which to return the ImageGear handle of the image. |
All pixel formats supported by ImageGear Professional.
Copy Code
|
|
---|---|
HIGEAR hIGear = 0; /* Will hold handle returned by IG_load_file*/ AT_ERRCOUNT nErrcount; /* Count of errs on stack upon ret from func*/ /* Load image file "picture.bmp" from working directory, creating DIB */ /* and obtaining the image's ImageGear handle: */ nErrcount = IG_load_file ( "picture.bmp" , &hIGear ); //... // Destroy the image if(IG_image_is_valid(hIGear)) { IG_image_delete(hIGear); } |
The handle which ImageGear assigns for this image is returned to you in argument lphIGear. The file named by filename may be in any format recognized by ImageGear. IG_load_file() will determine the format by inspecting the file's header section. See ImageGear Supported File Formats Reference for information on image file formats supported by ImageGear.
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. Some file formats, such as TXT, 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 Using Format Filters API for Filter Control. |
If the file pointed to by lpszFileName has multiple pages (images), the function will load the first page. To load pages of multi-page images, use IG_fltr_load_file, IG_load_FD or IG_load_mem. |