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

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

Declaration:

 
Copy Code
AT_ERRCOUNT ACCUAPI IG_fltr_save_FD_size_calc(
   HIGEAR hIGear,
   AT_INT reserved_fd,
   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 on which to calculate the size.
reserved_fd AT_INT Reserved for future use. Set to 0.
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 saved 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_FD_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_save_FD 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 multipage 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.

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