diff --git a/pyproject.toml b/pyproject.toml index 50a642f2..1edc44f7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -186,7 +186,6 @@ test = [ "python-xmp-toolkit==2.0.1", # also requires apt-get install libexempi3 "reportlab>=3.6.8", # Type stubs for testing - "types-Pillow", "types-humanfriendly", # Extended test capabilities (merged from extended_test) "pymupdf>=1.24.14", diff --git a/src/ocrmypdf/_exec/ghostscript.py b/src/ocrmypdf/_exec/ghostscript.py index 4dc98d72..bcee06fe 100644 --- a/src/ocrmypdf/_exec/ghostscript.py +++ b/src/ocrmypdf/_exec/ghostscript.py @@ -209,6 +209,7 @@ def rasterize_pdf( ) try: + im: Image.Image with Image.open(output_file) as im: if needs_low_dpi_resize: # Resize to the dimensions that would have resulted from the diff --git a/src/ocrmypdf/_pipeline.py b/src/ocrmypdf/_pipeline.py index 0f568a39..1d7af857 100644 --- a/src/ocrmypdf/_pipeline.py +++ b/src/ocrmypdf/_pipeline.py @@ -683,6 +683,7 @@ def create_ocr_image(image: Path, page_context: PageContext) -> Path: """ output_file = page_context.get_path('ocr.png') options = page_context.options + im: Image.Image with Image.open(image) as im: log.debug('resolution %r', im.info['dpi']) diff --git a/uv.lock b/uv.lock index 8f330184..a23b9a5e 100644 --- a/uv.lock +++ b/uv.lock @@ -1483,7 +1483,6 @@ test = [ { name = "python-xmp-toolkit" }, { name = "reportlab" }, { name = "types-humanfriendly" }, - { name = "types-pillow" }, ] [package.metadata] @@ -1540,7 +1539,6 @@ test = [ { name = "python-xmp-toolkit", specifier = "==2.0.1" }, { name = "reportlab", specifier = ">=3.6.8" }, { name = "types-humanfriendly" }, - { name = "types-pillow" }, ] [[package]] @@ -3086,15 +3084,6 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/2c/9f/694f2a833cda25f633c0c53e1d9e65a8a46b887ed4dd30f20de22e7100ee/types_humanfriendly-10.0.1.20250319-py3-none-any.whl", hash = "sha256:0fec93cc793b91309481ed4bb9bed178ffde0076026fb3ac1cc3299ad7ecbc46", size = 14835, upload-time = "2025-03-19T02:52:17.906Z" }, ] -[[package]] -name = "types-pillow" -version = "10.2.0.20240822" -source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/18/4a/4495264dddaa600d65d68bcedb64dcccf9d9da61adff51f7d2ffd8e4c9ce/types-Pillow-10.2.0.20240822.tar.gz", hash = "sha256:559fb52a2ef991c326e4a0d20accb3bb63a7ba8d40eb493e0ecb0310ba52f0d3", size = 35389, upload-time = "2024-08-22T02:32:48.15Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/66/23/e81a5354859831fcf54d488d33b80ba6133ea84f874a9c0ec40a4881e133/types_Pillow-10.2.0.20240822-py3-none-any.whl", hash = "sha256:d9dab025aba07aeb12fd50a6799d4eac52a9603488eca09d7662543983f16c5d", size = 54354, upload-time = "2024-08-22T02:32:46.664Z" }, -] - [[package]] name = "typing-extensions" version = "4.15.0"