ImageGear for C and C++ on Windows v19.2 - Updated
IG_fltr_save_file_W
API Reference Guide > Core Component API Reference > Core Component Functions Reference > Filter Functions > IG_fltr_save_file_W

This function stores the image referenced by hIGear to a file, where the file name is specified as a wide string (UTF-16).

Declaration:

 
Copy Code
AT_ERRCOUNT ACCUAPI IG_fltr_save_file_W(
   HIGEAR hIGear,
   const LPAT_WCHAR lpwszFileName,
   AT_LMODE lFormatType,
   UINT nPageNumber,
   AT_BOOL bOverwrite
);

Arguments:

Name Type Description
hIGear HIGEAR HIGEAR handle of the image to save.
lpwszFileName const LPAT_WCHAR Path and name of the file to which to save the image, specified as a wide string (UTF-16). 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 multi-page, 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 multi-page 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:

None

Example:

 
Copy Code
AT_ERRCOUNT     nErrcount;            // Count of returned errors on stack
HIGEAR hIGear;                        //ImageGear handle
nErrcount = IG_fltr_load_file_W(L"picture.tif", 1, &hIGear);
if(nErrcount == 0)
{
    // Save image to file "picture.bmp" in BMP format without compression:
    nErrcount = IG_fltr_save_file_W(hIGear, L"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.