mirror of
https://github.com/ocrmypdf/OCRmyPDF.git
synced 2025-06-26 23:49:59 +00:00
Disable --remove-background so we can remove leptonica
This commit is contained in:
parent
f8c6be2e26
commit
59642a98b2
@ -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
|
||||
|
@ -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")
|
||||
|
@ -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',
|
||||
|
@ -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',
|
||||
|
@ -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:
|
||||
|
Loading…
x
Reference in New Issue
Block a user