ImageGear for C and C++ on Linux v19.10 - Updated
Create and Delete a Multi-Page Image Object
User Guide > How to Work with... > Common Operations > Manipulating Image Data > Work with Multi-Page Documents (HMIGEAR) > Create and Delete a Multi-Page Image Object

An internal representation of a multi-page image is an object of the data type HMIGEAR. This data type encapsulates an array of pages, whose objects are of type HIGEAR. All IG_mpi_*** functions are introduced to access and manage this array.

The first step when working with a multi-page image is to allocate and initialize an object of type HMIGEAR. To do this, call the function IG_mpi_create(). This function creates a new multi-page image and sets the page array size to the given number of pages. Pages are numbered from 0 to nPageCount-1, where nPageCount is the current size of the page array, and the default page value is NULL.

A multi-page image is an array of pages. It is not necessary that all elements of this array contain valid HIGEAR objects. Some pages may have a NULL value, and the function IG_mpi_page_is_valid() can be used to quickly identify whether a page with a given number contains a valid HIGEAR image. The function IG_mpi_page_get() retrieves the value, and the IG_mpi_page_set() function replaces a page value with a given index in the page array of a multi-page image.

The function IG_mpi_page_count_get() returns the current size of a page array, and the function IG_mpi_page_count_set() changes the size of the page array.

When a multi-page image is no longer needed, you should delete it using the IG_mpi_page_delete() function. This function deletes all valid pages in the array and frees all memory allocated in the HMIGEAR handle.