Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
173ce2f215 | ||
|
|
9b641055e1 |
@@ -16,6 +16,12 @@ Note that it is licensed under GPLv3, so scripts that
|
||||
``import ocrmypdf`` and are released publicly should probably also be
|
||||
licensed under GPLv3.
|
||||
|
||||
v10.3.3
|
||||
=======
|
||||
|
||||
- Fixed a "KeyError: 'dpi'" error message when using ``--threshold`` on an image.
|
||||
(#607)
|
||||
|
||||
v10.3.2
|
||||
=======
|
||||
|
||||
|
||||
@@ -530,7 +530,9 @@ def create_ocr_image(image: Path, page_context: PageContext):
|
||||
if options.threshold:
|
||||
pix = leptonica.Pix.frompil(im)
|
||||
pix = pix.masked_threshold_on_background_norm()
|
||||
im = pix.topil()
|
||||
im_pix = pix.topil()
|
||||
im_pix.info['dpi'] = im.info['dpi']
|
||||
im = im_pix
|
||||
|
||||
del draw
|
||||
|
||||
|
||||
@@ -877,3 +877,17 @@ def test_image_dpi_not_image(caplog, resources, outpdf):
|
||||
'tests/plugins/tesseract_noop.py',
|
||||
)
|
||||
assert '--image-dpi is being ignored' in caplog.text
|
||||
|
||||
|
||||
def test_image_dpi_threshold(resources, outpdf):
|
||||
check_ocrmypdf(
|
||||
resources / 'typewriter.png',
|
||||
outpdf,
|
||||
'--threshold',
|
||||
'--image-dpi=170',
|
||||
'--output-type=pdf',
|
||||
'--optimize=0',
|
||||
'--plugin',
|
||||
'tests/plugins/tesseract_noop.py',
|
||||
)
|
||||
assert outpdf.exists()
|
||||
|
||||
Reference in New Issue
Block a user