ImageGear for C and C++ on Windows v20.0 - Updated
IG_fltr_save_file
API Reference Guide > Core Component API Reference > Core Component Functions Reference > Filter Functions > IG_fltr_save_file

This function stores the image referenced by hIGear to a file.

Declaration:

 
Copy Code
AT_ERRCOUNT ACCUAPI IG_fltr_save_file(
   HIGEAR hIGear,
   const LPSTR lpszFileName,
   AT_LMODE lFormatType,
   UINT nPageNumber,
   AT_BOOL bOverwrite
);

Arguments:

Name Type Description
hIGear HIGEAR HIGEAR handle of the image to save.
lpszFileName const LPSTR Path and name of the file to save the image to. The path can be absolute or relative.
lFormatType AT_LMODE Specifies the format to use for saving, and also the compression scheme if applicable. See enumIGSaveFormats for possible values.
nPageNumber UINT Specifies the page number of the page inserted into a multi-page file. Note that page numbers begin at 1, not 0. Set to 0 to append the page after the last page of the source file. Set to 1 if the file format does not support multipage, or if saving to a new file.
bOverwrite AT_BOOL Set to TRUE to overwrite existing file during the saving. Set to FALSE to insert or append the page to the file, if the format supports multipage saving.

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

Example:

 
Copy Code
AT_ERRCOUNT     nErrcount;            // Count of returned errors on stack
HIGEAR hIGear;                        //ImageGear handle
nErrcount = IG_load_file("picture.tif", &hIGear);
if(nErrcount == 0)
{
    // Save image to file "picture.bmp" in BMP format without compression:
    nErrcount = IG_fltr_save_file(hIGear, "picture_new.bmp", IG_SAVE_BMP_UNCOMP, 1, TRUE);
    IG_image_delete(hIGear);
}

Remarks:

lFormatType is used to set the format and compression (if applicable) of the output file. If you want to have ImageGear use the file extension provided in your filename string (lpszFilename) to determine the file format in which to save the file, set lFormatType = IG_SAVE_UNKNOWN.

See also the section Saving.

Is this page helpful?
Yes No
Thanks for your feedback.