diff --git a/misc/completion/ocrmypdf.bash b/misc/completion/ocrmypdf.bash index 3683d8f7..e3bd25a9 100644 --- a/misc/completion/ocrmypdf.bash +++ b/misc/completion/ocrmypdf.bash @@ -38,7 +38,7 @@ _ocrmypdf() if [[ $cur == -* ]]; then COMPREPLY=( $( compgen -W '--language --image-dpi --output-type --sidecar --version --jobs --quiet --verbose --title --author - --subject --keywords --rotate-pages --remove-background --deskew + --subject --keywords --rotate-pages --deskew --clean --clean-final --unpaper-args --oversample --remove-vectors --force-ocr --skip-text --redo-ocr --skip-big --jpeg-quality --png-quality --jbig2-lossy diff --git a/src/ocrmypdf/_pipeline.py b/src/ocrmypdf/_pipeline.py index af603357..cddc176c 100644 --- a/src/ocrmypdf/_pipeline.py +++ b/src/ocrmypdf/_pipeline.py @@ -20,7 +20,6 @@ import pikepdf from pikepdf.models.metadata import encode_pdf_date from PIL import Image, ImageColor, ImageDraw -from ocrmypdf import leptonica from ocrmypdf._concurrent import Executor from ocrmypdf._exec import unpaper from ocrmypdf._jobcontext import PageContext, PdfContext @@ -466,7 +465,8 @@ def rasterize( def preprocess_remove_background(input_file: Path, page_context: PageContext): if any(image.bpc > 1 for image in page_context.pageinfo.images): output_file = page_context.get_path('pp_rm_bg.png') - leptonica.remove_background(input_file, output_file) + # leptonica.remove_background(input_file, output_file) + raise NotImplementedError("--remove-background is temporarily not implemented") return output_file else: log.info("background removal skipped on mono page") diff --git a/tests/test_image_input.py b/tests/test_image_input.py index bbce6011..c3d01b5f 100644 --- a/tests/test_image_input.py +++ b/tests/test_image_input.py @@ -74,6 +74,7 @@ def test_img2pdf_fails(resources, no_outpdf): mock.assert_called() +@pytest.mark.xfail(reason="remove background disabled") def test_jpeg_in_jpeg_out(resources, outpdf): check_ocrmypdf( resources / 'congress.jpg', diff --git a/tests/test_main.py b/tests/test_main.py index 70359cdb..c9a5b754 100644 --- a/tests/test_main.py +++ b/tests/test_main.py @@ -165,7 +165,6 @@ def test_maximum_options(renderer, output_type, resources, outpdf): '-k', '--oversample', '300', - '--remove-background', '--skip-big', '10', '--title', @@ -533,7 +532,7 @@ def test_pagesize_consistency(renderer, resources, outpdf): renderer, '--clean' if have_unpaper() else None, '--deskew', - '--remove-background', + # '--remove-background', '--clean-final' if have_unpaper() else None, '-k', '--pages', diff --git a/tests/test_preprocessing.py b/tests/test_preprocessing.py index 6418ad6b..d4b4d63b 100644 --- a/tests/test_preprocessing.py +++ b/tests/test_preprocessing.py @@ -41,6 +41,7 @@ def test_deskew(resources, outdir): assert -0.5 < skew_angle < 0.5, "Deskewing failed" +@pytest.mark.xfail(reason="remove background disabled") def test_remove_background(resources, outdir): # Ensure the input image does not contain pure white/black with Image.open(resources / 'congress.jpg') as im: