Make debug dump of pageinfo at the end of processing readable

This commit is contained in:
James R. Barlow 2016-11-04 02:23:02 -07:00
parent 427add3008
commit c096b4ca8c
2 changed files with 9 additions and 4 deletions

View File

@ -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 = []

View File

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