Obtain Image Info
When exporting from presentation graphics files, and when using the pdf2sr
reader to export from PDF files, KeyView can obtain information about the number of images that it would create during export, without having to run a full export. This option uses function pointers that are part of the KVXMLInterfaceEx structure.
To extract image information
- Initialize an image information session by calling the
fpGetOutputImageInfos()
function. You must pass the return value for this function to the other image functions. - Call the
fpGetOutputImageCount()
function to get the number of images identified. - (Optional) For each image, call
fpGetOutputImageInfo()
to obtain the image dimensions. - Free the internal resources associated with the image information session by calling
fpFreeImageInfos()
.
Example
int numberOfImages = 0; void* pImageInfoContext = (*KVXMLInt.fpGetOutputImageInfos)(pContext, &inputStream, &options); if (pImageInfoContext == NULL) { // Error handling code would go here. // fpGetKvErrorCode() could be called here to investigate. } (*KVXMLInt.fpGetOutputImageCount)(pImageInfoContext, &numberOfImages); for (int i = 0; i < numberOfImages; i++) { KVXMLImageInfo imageInfo; KVStructInit(&imageInfo); if ((*KVXMLInt.fpGetOutputImageInfo)(pImageInfoContext, i, &imageInfo)) { // imageInfo.nWidth and imageInfo.nHeight // contain the dimensions at this point. } } (*KVXMLInt.fpFreeImageInfos)(pContext, pImageInfoContext); pImageInfoContext = NULL;