From 8013fd50da112b39df9bcb9672dce47bb3423350 Mon Sep 17 00:00:00 2001 From: "James R. Barlow" Date: Fri, 3 Aug 2018 13:32:10 -0700 Subject: [PATCH] Draw preview image at full resolution As reported in #281 and confirmed by the test file in #279, downsampling the preview adversely affects quality of image rotation especially for small font sizes and marginal scans. Full size gets rotation accuracy. This makes rotation a little inefficient since it rasterizes twice - to be addressed later. --- src/ocrmypdf/_pipeline.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ocrmypdf/_pipeline.py b/src/ocrmypdf/_pipeline.py index cf31dba6..607806af 100644 --- a/src/ocrmypdf/_pipeline.py +++ b/src/ocrmypdf/_pipeline.py @@ -349,8 +349,8 @@ def rasterize_preview( context): pageinfo = get_pageinfo(input_file, context) options = context.get_options() - canvas_dpi = get_canvas_square_dpi(pageinfo, options) / 2 - page_dpi = get_page_square_dpi(pageinfo, options) / 2 + canvas_dpi = get_canvas_square_dpi(pageinfo, options) + page_dpi = get_page_square_dpi(pageinfo, options) ghostscript.rasterize_pdf( input_file, output_file, xres=canvas_dpi, yres=canvas_dpi,