private static double WidthToDPI(SWMI.BitmapSource img, double pixels) { return pixels * 96 / img.DpiX; }
private static double HeightToDPI(SWMI.BitmapSource img, double pixels) { return pixels * 96 / img.DpiY; }