7290: use simpler math in image_dpi

This commit is contained in:
Vassilii Khachaturov 2013-12-14 16:06:59 +02:00
parent 2f5e221711
commit 2eca306acf

View File

@ -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