For —rotate-pages, rasterize preview at half DPI instead of 200 DPI

Ensures that time is not wasted on previews at higher resolution than
the input as was sometimes the case
This commit is contained in:
James R. Barlow
2017-05-29 13:01:18 -07:00
parent 28341b755f
commit d3c54fbbde
2 changed files with 12 additions and 6 deletions
+7 -6
View File
@@ -333,13 +333,14 @@ def rasterize_preview(
output_file,
log,
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
ghostscript.rasterize_pdf(
input_file=input_file,
output_file=output_file,
xres=200,
yres=200,
raster_device='jpeggray',
log=log)
input_file, output_file, xres=canvas_dpi, yres=canvas_dpi,
raster_device='jpeggray', log=log, page_dpi=(page_dpi, page_dpi))
def orient_page(
+5
View File
@@ -38,3 +38,8 @@ def test_userunit_qpdf_passes(spoof_tesseract_cache, poster, outpdf):
after = PdfInfo(outpdf)
assert isclose(before[0].width_inches, after[0].width_inches)
def test_rotate_interaction(spoof_tesseract_cache, poster, outpdf):
check_ocrmypdf(poster, outpdf, '--output-type=pdf',
'--rotate-pages',
env=spoof_tesseract_cache)