diff --git a/ocrmypdf/__main__.py b/ocrmypdf/__main__.py index b8302631..07b943c5 100755 --- a/ocrmypdf/__main__.py +++ b/ocrmypdf/__main__.py @@ -1529,7 +1529,10 @@ def run_pipeline(): _log.info("Output sent to stdout") with _pdfinfo_lock: - _log.debug(_pdfinfo) + if options.verbose: + from pprint import pformat + referent = _pdfinfo._getvalue() # get the real list out of proxy + _log.debug(pformat(referent)) direction = {0: 'n', 90: 'e', 180: 's', 270: 'w'} orientations = [] diff --git a/ocrmypdf/pageinfo.py b/ocrmypdf/pageinfo.py index 216562a5..9470f37c 100644 --- a/ocrmypdf/pageinfo.py +++ b/ocrmypdf/pageinfo.py @@ -326,9 +326,11 @@ def _find_page_regular_images(page, pageinfo, contentsinfo): image['dpi_w'] = max(dpi_w, image.get('dpi_w', 0)) image['dpi_h'] = max(dpi_h, image.get('dpi_h', 0)) - image['dpi_w'] = Decimal(image['dpi_w']) - image['dpi_h'] = Decimal(image['dpi_h']) - image['dpi'] = (image['dpi_w'] * image['dpi_h']) ** Decimal(0.5) + DPI_PREC = Decimal('1.000') + image['dpi_w'] = Decimal(image['dpi_w']).quantize(DPI_PREC) + image['dpi_h'] = Decimal(image['dpi_h']).quantize(DPI_PREC) + dpi = Decimal(image['dpi_w'] * image['dpi_h']).sqrt() + image['dpi'] = dpi.quantize(DPI_PREC) yield image