ImageGear Professional for Linux
IG_fltr_save_mem_size_calc

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

Declaration:

 
Copy Code
AT_ERRCOUNT ACCUAPI IG_fltr_save_mem_size_calc(
   HIGEAR hIGear,
   LPVOID lpImage,
   AT_UINT nImageSize,
   AT_LMODE lFormatType,
   AT_UINT nPageNumber,
   AT_BOOL reserved_overwrite,
   LPAT_UINT lpFileSize
);

Arguments:

Name Type Description
hIGear HIGEAR HIGEAR handle of the image on which to calculate the size.
lpImage LPVOID If the buffer exists and already contains an image file to which a page will be appended, this parameter specifies a pointer to first byte of the existing file in the memory buffer.
nImageSize AT_UINT If the buffer exists and already contains an image file to which a page will be appended, this parameter specifies the size of existing image.
lFormatType AT_LMODE Specifies the format to use for saving, and also the compression scheme if applicable. See enumIGSaveFormats for possible values.
nPageNumber AT_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.
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 Professional.

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_mem_size_calc(hIGear, NULL, 0, IG_SAVE_TIF_UNCOMP, 1, TRUE, &nFileSize);
    IG_image_delete(hIGear);
}

Remarks:

This function can be used prior to calling IG_fltr_save_mem to determine the amount of memory that needs to be allocated.

This function supports the calculation of a multipage image file size after addition of a page. If a file exists in the memory buffer before calling this function, and the file format supports appending pages, the function calculates the size of the file after appending the page.

See also the section Using Format Filters API for Image Saving.

 

 


©2016. Accusoft Corporation. All Rights Reserved.

Send Feedback