ImageGear for C and C++ on Windows v19.6 - Updated
IG_mpi_page_count_get
API Reference Guide > Core Component API Reference > Core Component Functions Reference > Multi Page Image Functions > IG_mpi_page_count_get

This function returns the number of pages in a multi-page image (the size of page array).

Declaration:

 
Copy Code
AT_ERRCOUNT ACCUAPI IG_mpi_page_count_get( 
        [IN] HMIGEAR hMIGear, 
        [OUT] LPUINT lpPageCount
);

Arguments:

Name Type Description
hMIGear HMIGEAR Handle to the allocated multi-page image.
lpPageCount LPUINT Pointer indicting where to return the number of pages of the given multi-page image.

Return Value:

Returns the number of ImageGear errors that occurred during this function call. If there are no errors, the return value is IGE_SUCCESS.

Supported Raster Image Formats:

All pixel formats supported by ImageGear for C and C++.

Sample:

MFC Multipage

Example:

 
Copy Code
HMIGEAR hMIGear;    /* handle to multi-page image */
AT_ERRCOUNT             nErrCount = IGE_SUCCESS; /* will hold returned error count  */
UINT nPageCount = 0; /* number of pages that should get from multi-page image */
UINT i,
                j = 0;
HIGEAR hIGear;    /* handle of an image */
 ...
/* initialize multi-page image and assign it with external file */
nErrCount = IG_mpi_page_count_get( hMIGear, &nPageCount );
for ( i = 0; i < nPageCount; i++ )
        if (!nErrCount)
        {
                nErrCount = IG_mpi_page_get( hMIGear, i, &hIGear );
                if (IG_mpi_page_is_valid(hMIGear, i))
                        j++;
        }
printf("Number of valid pages is:%i", j);

Remarks:

The HIGEAR handle of any given page is not significant in this function, other than to identify the image; this function simply counts the array size.