1
0
Fork 0
forked from josch/img2pdf

Python 2 does not automatically convert integers to floats, so we have to be a bit more explicit.

This commit is contained in:
Stephan Richter 2017-05-22 12:32:18 -04:00 committed by Johannes 'josch' Schauer
parent 18d637ea34
commit b25098c3f0
2 changed files with 6 additions and 6 deletions

View file

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

View file

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