pipeline: use the resolution of the OCR image rather than recalculating

(Recalculating would fail if the image is not centered.)
This commit is contained in:
James R. Barlow
2018-05-17 16:51:53 -07:00
parent 1d1962a106
commit b06ef03aac
+2 -3
View File
@@ -540,14 +540,13 @@ def select_ocr_image(
white = ImageColor.getcolor('#ffffff', im.mode)
draw = ImageDraw.ImageDraw(im)
xres = im.width / pageinfo.width_inches
yres = im.height / pageinfo.height_inches
xres, yres = im.info['dpi']
for textarea in pageinfo.get_textareas():
# Calculate resolution based on the image size and page dimensions
# without regard whatever resolution is in pageinfo (may differ or
# be None)
bbox = textarea['bbox']
log.debug('calculated resolution %r %r', xres, yres)
log.debug('resolution %r %r', xres, yres)
pixcoords = [Decimal(bbox[0]) / Decimal(72) * xres,
Decimal(bbox[1]) / Decimal(72) * yres,