From 2eca306acf1f35c50f0824a5a9096e667089fc3e Mon Sep 17 00:00:00 2001 From: Vassilii Khachaturov Date: Sat, 14 Dec 2013 16:06:59 +0200 Subject: [PATCH] 7290: use simpler math in image_dpi --- src/ImgManip.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ImgManip.py b/src/ImgManip.py index 7c1e9734f..374e4a691 100644 --- a/src/ImgManip.py +++ b/src/ImgManip.py @@ -103,7 +103,7 @@ def resize_to_jpeg(source, destination, width, height, crop=None): # image_dpi # #------------------------------------------------------------------------- -INCH_PER_MM = 1/25.4 +MM_PER_INCH = 25.4 def image_dpi(source): """ Return the dpi found in the image header. Use a sensible @@ -134,8 +134,8 @@ def image_dpi(source): try: import gtk dpi = ( - gtk.gdk.screen_width() / (INCH_PER_MM * gtk.gdk.screen_width_mm()), - gtk.gdk.screen_height() / (INCH_PER_MM * gtk.gdk.screen_height_mm()) + gtk.gdk.screen_width() * MM_PER_INCH / gtk.gdk.screen_width_mm(), + gtk.gdk.screen_height() * MM_PER_INCH / gtk.gdk.screen_height_mm() ) except: dpi = (96.0,96.0) #LibOO 3.6 assumes this if image contains no DPI info