From 7c48bfb86813bd0ede3fae2d0873e1efd022b79a Mon Sep 17 00:00:00 2001 From: Johannes Schauer Marin Rodrigues Date: Thu, 24 Mar 2022 12:43:49 +0100 Subject: [PATCH] find_scale(): better document why we use powers of 10 --- src/img2pdf.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/img2pdf.py b/src/img2pdf.py index 81d5ef6..f2045c4 100755 --- a/src/img2pdf.py +++ b/src/img2pdf.py @@ -2147,7 +2147,11 @@ def get_fixed_dpi_layout_fun(fixed_dpi): def find_scale(pagewidth, pageheight): """Find the power of 10 (10, 100, 1000...) that will reduce the scale - below the PDF specification limit of 14400 PDF units (=200 inches)""" + below the PDF specification limit of 14400 PDF units (=200 inches). + In principle we could also choose a scale that is not a power of 10. + We use powers of 10 because numbers in the PDF format are represented + in base-10 and using powers of 10 will thus just shift the comma and + keep the numbers easily readable by humans as well.""" from math import log10, ceil major = max(pagewidth, pageheight)