# How do I get the image resolution and DPI

63 views

### Martin Galabinski

Nov 18, 2014, 7:39:31 AM11/18/14
I cannot seem to find the information on "How do I get the image resolution and DPI"

I checked on the following page and it does not exist:
(as described in the following FAQ - http://www.pdftron.com/net/faq.html#img_01)

I did find a method called MatrixScale but it includes some errors.

static double MatrixScale(pdftron.Common.Matrix2D m)
{
double x = 0.707106781 * m.getA() + 0.707106781 * m.getB();
double y = 0.707106781 * m.getC() + 0.707106781 * m.getD();
return Math.Sqrt(x * x + y * y);
}

pdftron.Common.Matrix2D does not contain a definition for getA (etc)

Thanks, Marty

### Support

Nov 20, 2014, 2:06:06 AM11/20/14

This was the content of this Q&A from the old FAQ:

In PDF the image can be rotated by any degree. The image can also be stretched, skewed, etc. The transformation is specified using the Current Transformation Matrix (CTM) which can be accessed using the Element.GetCTM() method.

Use the following code snippet (pseudocode) to calculate image rotation angle (in radians):

```double GetRotation(Matrix2D& mtx) {
double x1=0, y1=0, x2=1, y2=0;
mtx.Mult(x1, y1);
mtx.Mult(x2, y2);
return atan2(y2-y1, x2-x1);
}```

The position of the image on the page is given using the translation component of the matrix (i.e mtx.m_h, mtx.m_v).