From b25098c3f0307d66359001ece07c9c11938193ef Mon Sep 17 00:00:00 2001 From: Stephan Richter Date: Mon, 22 May 2017 12:32:18 -0400 Subject: [PATCH] Python 2 does not automatically convert integers to floats, so we have to be a bit more explicit. --- src/img2pdf.py | 8 ++++---- src/tests/__init__.py | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/img2pdf.py b/src/img2pdf.py index fa5f40d..a97e5c2 100755 --- a/src/img2pdf.py +++ b/src/img2pdf.py @@ -744,19 +744,19 @@ def read_images(rawdata, colorspace, first_frame_only=False): # converts a length in pixels to a length in PDF units (1/72 of an inch) def px_to_pt(length, dpi): - return 72*length/dpi + return 72.0*length/dpi def cm_to_pt(length): - return (72*length)/2.54 + return (72.0*length)/2.54 def mm_to_pt(length): - return (72*length)/25.4 + return (72.0*length)/25.4 def in_to_pt(length): - return 72*length + return 72.0*length def get_layout_fun(pagesize=None, imgsize=None, border=None, fit=None, diff --git a/src/tests/__init__.py b/src/tests/__init__.py index caa201b..e6f3508 100644 --- a/src/tests/__init__.py +++ b/src/tests/__init__.py @@ -513,8 +513,8 @@ def test_suite(): # Search online for the 72.009 dpi problem for more info. ndpi = (int(round(ndpi[0])), int(round(ndpi[1]))) imgwidthpx, imgheightpx = orig_img.size - pagewidth = 72*imgwidthpx/ndpi[0] - pageheight = 72*imgheightpx/ndpi[1] + pagewidth = 72.0*imgwidthpx/ndpi[0] + pageheight = 72.0*imgheightpx/ndpi[1] def format_float(f): if int(f) == f: