pdfGetImageMatrix
Get an image matrix.
void pdfGetImageMatrix(PDFHandle pdf, int idx, double mat[6])
This function returns the image matrix for
the
idx
th image on the page specified in the
last call to pdfGetImages
.
The returned matrix is the PDF/PostScript-style matrix used to transform a 1x1 square to the target region where the image will be drawn. This information can be used to derive the horizontal and vertical image resolution (assuming a straight rotation with no shearing) - see the example code below.
C:
double mat[6];
double hRes, vRes;
int nImgs, i, mask, colorSpace, w, h;
pdfGetImages(pdf, 1);
nImgs = pdfGetNumImages(pdf);
for (i = 0; i < nImgs; ++i) {
pdfGetImageMatrix(pdf, i, mat);
hRes = (w / sqrt(mat[0] * mat[0] + mat[1] * mat[1])) * 72;
vRes = (h / sqrt(mat[2] * mat[2] + mat[3] * mat[3])) * 72;
printf("image %d: %d x %d pixels per inch\n", i, hRes, vRes);
}