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

This function is used to determine the size that is required for saving the image to the file in the given format.

Declaration:

 
Copy Code
AT_ERRCOUNT ACCUAPI IG_fltr_save_file_size_calc(
   HIGEAR hIGear,
   const LPSTR reserved_filename,
   AT_LMODE lFormatType,
   AT_UINT reserved_page,
   AT_BOOL reserved_overwrite,
   LPAT_UINT lpFileSize
);

Arguments:

Name Type Description
hIGear HIGEAR HIGEAR handle of the image for which to calculate the size.
reserved_filename const LPSTR Reserved for future use. Set to NULL.
lFormatType AT_LMODE Specifies the format to use for saving, and also the compression scheme if applicable. See enumIGSaveFormats for possible values.
reserved_page AT_UINT Reserved for future use. Set to 0.
reserved_overwrite AT_BOOL Reserved for future use. Set to FALSE.
lpFileSize LPAT_UINT Returns the maximum possible size of the file.

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;

HIGEAR hIGear = 0;
AT_UINT nFileSize;    // File size returned;
nErrCount = IG_load_file("picture.tif", &hIGear);
if(nErrCount == 0)
{
    nErrCount = IG_fltr_save_file_size_calc(hIGear, 0, IG_SAVE_TIF_UNCOMP, 1, TRUE, &nFileSize);
    IG_image_delete(hIGear);
}

Remarks:

This call may be used prior to calling IG_fltr_save_file to determine the size of result file.

As of this writing, the function can only calculate the size of a single-page file. To calculate the size of a multi-page file after addition of a page, load the original file into a memory buffer, and then use IG_fltr_save_mem_size_calc.

See also the section Saving.