ImageGear for C and C++ on Linux v18.8 - Updated
IG_image_savelist_get
API Reference Guide > Core Component API Reference > Core Component Functions Reference > General Image Functions > IG_image_savelist_get

This function prepares the list of constants corresponding to format and compression combinations available for saving of the specified image.

Declaration:

 
Copy Code
AT_ERRCOUNT ACCUAPI IG_image_savelist_get(
   HIGEAR hIGear,
   LPAT_MODE lpnFilterList,
   UINT nFListSize,
   LPAT_LMODE lpSaveList,
   UINT nSListSize,
   LPUINT lpnSListCount
);

Arguments:

Name Type Description
hIGear HIGEAR Handle of the image to check the compression list against. If the value is not NULL, this function returns the list of enumIGSaveFormats values corresponding to saving formats (format and compression combinations) available for saving of the specified image. If the value is NULL, then the function returns the list of all currently supported saving formats for file formats specified by lpnFilterList. If both the hIGear and lpnFilterList are null, the function returns the list of all currently supported saving formats.
lpnFilterList LPAT_MODE Pointer to the list of format identifiers, which will be used in the save list. See enumIGFormats for possible values. If this parameter is NULL, then all currently supported formats will be used.
nFListSize UINT Array containing the number of elements if lpnFilterList is not NULL.
lpSaveList LPAT_MODE Array containing the returned saving format constants. You can set this value to NULL if you only need to obtain the total number of found saving formats.
nSListSize UINT Size of the lpSaveList array.
lpnSListCount LPUINT If the lpSaveList array is not NULL, this parameter returns the number of copied enumIGSaveFormats values. If lpSaveList is NULL, this parameter returns the total number of records.

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++.

Example:

 
Copy Code
AT_ERRCOUNT nErrCount;  // Number of errors on stack
HIGEAR hIGear;          // Handle of image
UINT nCount;            // Number of save formats
LPAT_LMODE lpSaveList;

// Load the image
nErrCount = IG_load_file("picture.tif", &hIGear);
if( nErrCount == 0 ) 
{
    // Get save formats count 
    nErrCount = IG_image_savelist_get(hIGear, NULL, 0, NULL, 0, &nCount);
    // Allocate memory
    lpSaveList = (LPAT_LMODE)malloc( nCount*sizeof(AT_LMODE) );
    if( lpSaveList!=NULL )
    {
        // Get save list
        nErrCount = IG_image_savelist_get(hIGear, NULL, 0, lpSaveList, nCount, NULL);
        
        //...

        // Delete memory
        free(lpSaveList);
    }
    // Delete the image
    IG_image_delete(hIGear);
}

Remarks:

Records returned by the function are sorted alphabetically by their short names. Short names correspond to those returned by IG_fltr_info_get function.

This function works similarly to IG_fltr_compressionlist_get_ex, but it works with all formats supported by ImageGear rather than with a particular format. Values returned in the lpSaveList can be passed directly to ImageGear saving functions such as IG_fltr_save_file.

See also the section Saving.