public static double GetWidthInCm(int widthPixel, int dpiX) { // px / dpi = inch ( for height and width ) return ((double)((double)widthPixel / (double)dpiX) * intocm); }