7290: use simpler math in image_dpi
This commit is contained in:
parent
2f5e221711
commit
2eca306acf
@ -103,7 +103,7 @@ def resize_to_jpeg(source, destination, width, height, crop=None):
|
|||||||
# image_dpi
|
# image_dpi
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
INCH_PER_MM = 1/25.4
|
MM_PER_INCH = 25.4
|
||||||
def image_dpi(source):
|
def image_dpi(source):
|
||||||
"""
|
"""
|
||||||
Return the dpi found in the image header. Use a sensible
|
Return the dpi found in the image header. Use a sensible
|
||||||
@ -134,8 +134,8 @@ def image_dpi(source):
|
|||||||
try:
|
try:
|
||||||
import gtk
|
import gtk
|
||||||
dpi = (
|
dpi = (
|
||||||
gtk.gdk.screen_width() / (INCH_PER_MM * gtk.gdk.screen_width_mm()),
|
gtk.gdk.screen_width() * MM_PER_INCH / gtk.gdk.screen_width_mm(),
|
||||||
gtk.gdk.screen_height() / (INCH_PER_MM * gtk.gdk.screen_height_mm())
|
gtk.gdk.screen_height() * MM_PER_INCH / gtk.gdk.screen_height_mm()
|
||||||
)
|
)
|
||||||
except:
|
except:
|
||||||
dpi = (96.0,96.0) #LibOO 3.6 assumes this if image contains no DPI info
|
dpi = (96.0,96.0) #LibOO 3.6 assumes this if image contains no DPI info
|
||||||
|
Loading…
Reference in New Issue
Block a user