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

This function returns the list of compressions available for saving the specified image to a particular file format.

Declaration:

 
Copy Code
AT_ERRCOUNT ACCUAPI IG_fltr_compressionlist_get_ex(
   const HIGDIBINFO hDIB,
   AT_MODE nFormatID,
   LPAT_MODE lpComprList,
   UINT nCListSize,
   LPUINT lpnCListCount
);

Arguments:

Name Type Description
hDIB const HIGDIBINFO Handle of DIB info object that contains image parameters. If NULL, then this function returns all possible compressions.
nFormatID AT_MODE File format identifier. See enumIGFormats for possible values.
lpComprList LPAT_MODE Pointer to the array to return the list of compression constants to. See enumIGCompressions for possible values. Set to NULL if you only need to obtain the number of available compressions.
nCListSize UINT Size of the lpCompList array.
lpnCListCount LPUINT Pointer to a variable which will receive the actual number of compression constants.

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:

See GUI component source code.

Example:

 
Copy Code
AT_ERRCOUNT nErrCount;  // Number of errors on stack
HIGEAR hIGear;          // Handle of image
HIGDIBINFO hDIB;        // DIB info handle of image
UINT nCount, nActual;   // Number of compressions
LPAT_MODE lpCompList;   // List of compressions

// Load the image
nErrCount = IG_load_file("picture.tif", &hIGear);
if( nErrCount==0 ) 
{
    nErrCount = IG_image_DIB_info_get(hIGear, &hDIB);
    // Get compression count 
    nErrCount = IG_fltr_compressionlist_get_ex(hDIB, 
        IG_FORMAT_TIF, NULL, 0, &nCount);
    // Allocate memory for compressions
    lpCompList = (LPAT_MODE) malloc(nCount * sizeof(AT_MODE));
    // Get list of compressions that can be used when  
    // saving the given image into TIFF format
    nErrCount = IG_fltr_compressionlist_get_ex(hDIB, 
        IG_FORMAT_TIF, lpCompList, nCount, &nActual);

    // ...

    // Delete memory
    free(lpCompList);
    // Delete DIB info
    IG_DIB_info_delete(hDIB);
    // Delete the image
    IG_image_delete(hIGear);
}

Remarks:

See also the section Saving.