diff --git a/misc/completion/ocrmypdf.bash b/misc/completion/ocrmypdf.bash index b652769e..3683d8f7 100644 --- a/misc/completion/ocrmypdf.bash +++ b/misc/completion/ocrmypdf.bash @@ -40,7 +40,7 @@ _ocrmypdf() --sidecar --version --jobs --quiet --verbose --title --author --subject --keywords --rotate-pages --remove-background --deskew --clean --clean-final --unpaper-args --oversample --remove-vectors - --threshold --force-ocr --skip-text --redo-ocr + --force-ocr --skip-text --redo-ocr --skip-big --jpeg-quality --png-quality --jbig2-lossy --max-image-mpixels --tesseract-config --tesseract-pagesegmode --help --tesseract-oem --pdf-renderer --tesseract-timeout diff --git a/misc/completion/ocrmypdf.fish b/misc/completion/ocrmypdf.fish index d4bb76d3..fd1e54a0 100644 --- a/misc/completion/ocrmypdf.fish +++ b/misc/completion/ocrmypdf.fish @@ -29,7 +29,6 @@ complete -c ocrmypdf -s d -l deskew -d "fix small horizontal alignment skew" complete -c ocrmypdf -s c -l clean -d "clean document images before OCR" complete -c ocrmypdf -s i -l clean-final -d "clean document images and keep result" complete -c ocrmypdf -l remove-vectors -d "don't send vector objects to OCR" -complete -c ocrmypdf -l threshold -d "threshold images before OCR" complete -c ocrmypdf -s f -l force-ocr -d "OCR documents that already have printable text" complete -c ocrmypdf -s s -l skip-ocr -d "skip OCR on pages that text, otherwise try OCR" diff --git a/src/ocrmypdf/_pipeline.py b/src/ocrmypdf/_pipeline.py index a5f6ba56..af603357 100644 --- a/src/ocrmypdf/_pipeline.py +++ b/src/ocrmypdf/_pipeline.py @@ -541,14 +541,6 @@ def create_ocr_image(image: Path, page_context: PageContext): log.debug('blanking %r', pixcoords) draw.rectangle(pixcoords, fill=white) # draw.rectangle(pixcoords, outline=pink) - - if options.threshold: - pix = leptonica.Pix.frompil(im) - pix = pix.masked_threshold_on_background_norm() - im_pix = pix.topil() - im_pix.info['dpi'] = im.info['dpi'] - im = im_pix - del draw filter_im = page_context.plugin_manager.hook.filter_ocr_image( diff --git a/src/ocrmypdf/api.py b/src/ocrmypdf/api.py index 8f731fa3..ac21ebb7 100644 --- a/src/ocrmypdf/api.py +++ b/src/ocrmypdf/api.py @@ -228,7 +228,6 @@ def ocr( # pylint: disable=unused-argument unpaper_args: str = None, oversample: int = None, remove_vectors: bool = None, - threshold: bool = None, force_ocr: bool = None, skip_text: bool = None, redo_ocr: bool = None, diff --git a/src/ocrmypdf/cli.py b/src/ocrmypdf/cli.py index 87012321..7f01e0e9 100644 --- a/src/ocrmypdf/cli.py +++ b/src/ocrmypdf/cli.py @@ -287,14 +287,6 @@ Online documentation is located at: help="EXPERIMENTAL. Mask out any vector objects in the PDF so that they " "will not be included in OCR. This can eliminate false characters.", ) - preprocessing.add_argument( - '--threshold', - action='store_true', - help=( - "EXPERIMENTAL. Threshold image to 1bpp before sending it to Tesseract " - "for OCR. Can improve OCR quality compared to Tesseract's thresholder." - ), - ) ocrsettings = parser.add_argument_group("OCR options", "Control how OCR is applied") ocrsettings.add_argument( diff --git a/tests/test_main.py b/tests/test_main.py index 50081637..70359cdb 100644 --- a/tests/test_main.py +++ b/tests/test_main.py @@ -869,20 +869,6 @@ def test_image_dpi_not_image(caplog, resources, outpdf): 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() - - def test_outputtype_none_bad_setup(resources, outpdf): p, _out, err = run_ocrmypdf( resources / 'trivial.pdf',