Fix handling of DPI for rare case of JPEG recompression after deskew/clean
This test is exercised by page 4 of multipage.pdf. If all images are JPEGs, and one of deskew/clean removes DPI information, make sure that we can get the right information back and that the DPI stays square.
This commit is contained in:
@@ -14,9 +14,9 @@ In some cases they were converted from one image format to another without other
|
||||
+=====================+================================================================================+
|
||||
| c02-22.pdf | `Project Gutenberg`_, Adventures of Huckleberry Finn, page 22 |
|
||||
+---------------------+--------------------------------------------------------------------------------+
|
||||
| congress.jpg | `US Congressional Records`_ |
|
||||
| congress.jpg | `US Congressional Records`_ (Public Domain) |
|
||||
+---------------------+--------------------------------------------------------------------------------+
|
||||
| graph.pdf | `Wikimedia: Pandas text analysis.png`_ |
|
||||
| graph.pdf | `Wikimedia: Pandas text analysis.png`_ (Public Domain) |
|
||||
+---------------------+--------------------------------------------------------------------------------+
|
||||
| lichtenstein.pdf | `Wikimedia: JPEG2000 Lichtenstein`_ (Creative Commons BY-SA 3.0) |
|
||||
+---------------------+--------------------------------------------------------------------------------+
|
||||
|
||||
+3
-3
@@ -565,8 +565,8 @@ def test_algo4():
|
||||
|
||||
|
||||
@pytest.mark.parametrize('renderer', [
|
||||
'hocr'])
|
||||
def test_non_square_resolution(renderer):
|
||||
'hocr']) # tesseract cannot pass this test yet
|
||||
def test_non_square_resolution(renderer, spoof_tesseract_cache):
|
||||
# Confirm input image is non-square resolution
|
||||
in_pageinfo = pdf_get_all_pageinfo(_infile('aspect.pdf'))
|
||||
assert in_pageinfo[0]['xres'] != in_pageinfo[0]['yres']
|
||||
@@ -574,7 +574,7 @@ def test_non_square_resolution(renderer):
|
||||
out = 'aspect_%s.pdf' % renderer
|
||||
check_ocrmypdf(
|
||||
'aspect.pdf', out,
|
||||
'--pdf-renderer', renderer)
|
||||
'--pdf-renderer', renderer, env=spoof_tesseract_cache)
|
||||
|
||||
out_pageinfo = pdf_get_all_pageinfo(_outfile(out))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user