Fix issue with attempting to deskew a blank page on Tesseract 5
Closes #868
This commit is contained in:
@@ -200,7 +200,9 @@ def get_deskew(
|
||||
except CalledProcessError as e:
|
||||
tesseract_log_output(e.stdout)
|
||||
tesseract_log_output(e.stderr)
|
||||
if b'Empty page!!' in e.output: # Not enough info for a skew angle
|
||||
if b'Empty page!!' in e.output or (
|
||||
e.output == b'' and e.returncode == 1
|
||||
): # Not enough info for a skew angle - Tess 4 and 5 return different errors
|
||||
return 0.0
|
||||
|
||||
raise SubprocessOutputError() from e
|
||||
|
||||
@@ -40,6 +40,11 @@ def test_deskew(resources, outdir):
|
||||
assert -0.5 < skew_angle < 0.5, "Deskewing failed"
|
||||
|
||||
|
||||
def test_deskew_blank_page(resources, outpdf):
|
||||
# Tesseract doesn't like blank pages - make sure we can get through
|
||||
check_ocrmypdf(resources / 'blank.pdf', outpdf, '--deskew')
|
||||
|
||||
|
||||
@pytest.mark.xfail(reason="remove background disabled")
|
||||
def test_remove_background(resources, outdir):
|
||||
# Ensure the input image does not contain pure white/black
|
||||
|
||||
Reference in New Issue
Block a user