ImageGear Professional DLL v17.1 for Windows Accusoft
IG_fltr_save_mem_size_calc
Send Feedback  
ImageGear Professional DLL v17.1 for Windows > API Reference Guide > Core Component API Reference > Core Component Functions Reference > Filter Functions > IG_fltr_save_mem_size_calc

Glossary Item Box

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:

hIGear HIGEAR handle of the image on which to calculate the size.
lpImage 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 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 Specifies the format to use for saving, and also the compression scheme if applicable. See enumIGSaveFormats for possible values.
nPageNumber 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 Reserved for future use. Set to FALSE.
lpFileSize 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.

Sample:

Memory IO

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.

©2012. Accusoft Corporation. All Rights Reserved.