Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/ocrmypdf/OCRmyPDF
Browse files Browse the repository at this point in the history
  • Loading branch information
James Barlow committed Jul 5, 2024
2 parents 6a8eb7d + fac91fc commit d544342
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
9 changes: 9 additions & 0 deletions docs/release_notes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
=======

Expand Down
2 changes: 1 addition & 1 deletion src/ocrmypdf/_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand Down
3 changes: 2 additions & 1 deletion src/ocrmypdf/optimize.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
Stream,
UnsupportedImageTypeError,
)
from pikepdf.models.image import HifiPrintImageNotTranscodableError
from PIL import Image

from ocrmypdf._concurrent import Executor, SerialExecutor
Expand Down Expand Up @@ -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 (
Expand Down

0 comments on commit d544342

Please sign in to comment.