ImageGear for C and C++ on Linux v19.10 - Updated
IG_fltr_compressionlist_get
API Reference Guide > Core Component API Reference > Core Component Functions Reference > Filter Functions > IG_fltr_compressionlist_get

This function returns the list of compressions available for saving the specified image to a particular file format. This is an obsolete function, see remarks.

Declaration:

 
Copy Code
AT_ERRCOUNT ACCUAPI IG_fltr_compressionlist_get(
   LPAT_DIB lpDIB,
   AT_MODE nFormatID,
   LPAT_MODE lpComprList,
   UINT nCListSize,
   LPUINT lpnCListCount
);

Arguments:

Name Type Description
lpDIB LPAT_DIB Pointer to the AT_DIB structure 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:

Example:

 
Copy Code
AT_ERRCOUNT nErrCount;  // Number of errors on stack
HIGEAR hIGear;          // 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 ) 
{
    AT_DIB atDib;
    AT_DIMENSION nWidth, nHeight;
    UINT nBitsPerPixel;
    // Get image info
    nErrCount = IG_image_dimensions_get(hIGear, &nWidth, &nHeight, &nBitsPerPixel);
    // Fill in AT_DIB structure
    memset(&atDib, 0, sizeof(AT_DIB));
    atDib.biSize = sizeof(AT_DIB);
    atDib.biWidth = nWidth;
    atDib.biHeight = nHeight;
    atDib.biPlanes = 1;
    atDib.biBitCount = nBitsPerPixel;
    
    // Get compression count 
    nErrCount = IG_fltr_compressionlist_get(&atDib, 
        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(&atDib, 
        IG_FORMAT_TIF, lpCompList, nCount, &nActual);

    // ...

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

Remarks:

This function is only kept for backward compatibility reasons. Please use IG_fltr_compressionlist_get_ex instead.

See also the section Saving.