From 4fb1bb4de6afe923819d8ff333beabf461dc0fb7 Mon Sep 17 00:00:00 2001 From: "James R. Barlow" Date: Sun, 30 Jun 2024 00:08:31 -0700 Subject: [PATCH 1/3] pipeline: fix typo in message --- src/ocrmypdf/_pipeline.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ocrmypdf/_pipeline.py b/src/ocrmypdf/_pipeline.py index 043a78a00..e66762e74 100644 --- a/src/ocrmypdf/_pipeline.py +++ b/src/ocrmypdf/_pipeline.py @@ -475,7 +475,7 @@ def calculate_raster_dpi(page_context: PageContext): page_dpi = get_page_square_dpi(page_context, image_dpi) if dpi_profile and dpi_profile.average_to_max_dpi_ratio < 0.8: log.warning( - "Weight average image DPI is %0.1f, max DPI is %0.1f. " + "Weighted average image DPI is %0.1f, max DPI is %0.1f. " "The discrepancy may indicate a high detail region on this page, " "but could also indicate a problem with the input PDF file. " "Page image will be rendered at %0.1f DPI.", From 6edf7568495913e924265cf447e64fee2427ea54 Mon Sep 17 00:00:00 2001 From: "James R. Barlow" Date: Sun, 30 Jun 2024 00:08:51 -0700 Subject: [PATCH 2/3] optimize: trap Hifi..Error Fixes [Bug]: NotImplementedError: not sure how to get colorspace #1315 --- src/ocrmypdf/optimize.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ocrmypdf/optimize.py b/src/ocrmypdf/optimize.py index 06f5de250..43506dc6f 100644 --- a/src/ocrmypdf/optimize.py +++ b/src/ocrmypdf/optimize.py @@ -28,6 +28,7 @@ Stream, UnsupportedImageTypeError, ) +from pikepdf.models.image import HifiPrintImageNotTranscodableError from PIL import Image from ocrmypdf._concurrent import Executor, SerialExecutor @@ -200,7 +201,7 @@ def extract_image_generic( with imgname.open('wb') as f: ext = pim.extract_to(stream=f) imgname.rename(imgname.with_suffix(ext)) - except UnsupportedImageTypeError: + except (UnsupportedImageTypeError, HifiPrintImageNotTranscodableError): return None return XrefExt(xref, ext) elif ( From fac91fca2ab17aa7415ce1d2b2b182c1d9a7803c Mon Sep 17 00:00:00 2001 From: "James R. Barlow" Date: Sun, 30 Jun 2024 00:11:27 -0700 Subject: [PATCH 3/3] v16.4.1 release notes --- docs/release_notes.rst | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/docs/release_notes.rst b/docs/release_notes.rst index b51b9a963..522ccbd3f 100644 --- a/docs/release_notes.rst +++ b/docs/release_notes.rst @@ -30,6 +30,15 @@ OCRmyPDF typically supports the three most recent Python versions. .. |OCRmyPDF PyPI| image:: https://img.shields.io/pypi/v/ocrmypdf.svg +v16.4.1 +======= + +- Fixed calculation of image printed area (used in finding weighted DPI for OCR). + :issue:`1334` +- Fixed "NotImplementedError: not sure how to get colorspace" error + messages in logs which simply records a failure to optimize images with + print production colorspaces. :issue:`1315` + v16.4.0 =======