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

If a multi-page image is associated with the external file, it loads a page of the specified index from an external file and returns it using the parameter lphIGear.

Declaration:

 
Copy Code
AT_ERRCOUNT IG_mpf_page_get( 
        [IN] HMIGEAR hMIGear, 
        [IN] UINT nPage, 
        [OUT] LPHIGEAR lphIGear
);

Arguments:

Name Type Description
hMIGear HMIGEAR Handle to the allocated multi-page image.
nPage UINT The index page to load.
lphIGear LPHIGEAR Indicates where to return the image handle.

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:

None

Example:

 
Copy Code
    AT_ERRCOUNT nErrCount; // Returned count of errors
    HMIGEAR hMPDoc;        // Handle of multipage image
    HIGEAR hIGear;         // Handle of the page image
    nErrCount = IG_mpi_create(&hMPDoc, 0);
    if(nErrCount == 0)
    {
        nErrCount = IG_mpi_file_open("multipage.tif", hMPDoc, 0, IG_MP_OPENMODE_READONLY);
        if(nErrCount == 0)
        {
            nErrCount = IG_mpf_page_get(hMPDoc, 0, &hIGear);
            if(nErrCount == 0)
            {
                //...
                // Destroy the image
                IG_image_delete(hIGear);
            }
        }
        // Destroy multipage document
        IG_mpi_delete(hMPDoc);
    }

Remarks:

If a multi-page image is not associated with the external file, or a failure to load a page occurs, then an error is set. This function does not change the multi-page image.