This function obtains the number of pages in the memory image file.
Copy Code
|
|
---|---|
AT_ERRCOUNT ACCUAPI IG_page_count_get_mem( LPVOID lpImage, AT_UINT nImageSize, LPUINT lpPageCount ); |
Name | Type | Description |
---|---|---|
lpImage | LPVOID | Pointer to start of file image in memory. |
nImageSize | AT_UINT | Size of image in memory. |
lpPageCount | LPUINT | Pointer to a UINT variable to receive page count. |
All pixel formats supported by ImageGear for C and C++.
Memory IO
Copy Code
|
|
---|---|
char* lpBuffer; // Memory buffer with the image AT_UINT nBufferSize; // Size of the memory buffer UINT nPageCount; // Will receive number of pages AT_ERRCOUNT nErrcount; // Returned count of errors // Open a file and get its size FILE* fp = NULL; fopen_s(&fp, "picture.bmp", "rb"); if(fp != NULL) { fseek(fp, 0, SEEK_END); nBufferSize = (AT_UINT)ftell(fp); fseek(fp, 0, SEEK_SET); // Allocate memory and read the image into the memory buffer lpBuffer = (char*)malloc(nBufferSize); fread(lpBuffer, 1, nBufferSize, fp); // File is no longer needed - close it fclose(fp); // Get image info nErrcount = IG_page_count_get_mem(lpBuffer, nBufferSize, &nPageCount); fclose(fp); // ... // Delete memory buffer free(lpBuffer); } |
See also functions IG_page_count_get_FD and IG_page_count_get.