Remove deprecated falsy handling of filter_page_image

This commit is contained in:
James R. Barlow
2022-08-04 04:21:15 -07:00
parent 4d2f499f97
commit c9389c7713
2 changed files with 9 additions and 7 deletions
+2 -2
View File
@@ -206,8 +206,8 @@ def exec_page_sync(page_context: PageContext) -> PageResult:
filtered_image = page_context.plugin_manager.hook.filter_page_image(
page=page_context, image_filename=visible_image_out
)
if filtered_image:
visible_image_out = filtered_image
visible_image_out = filtered_image
pdf_page_from_image_out = create_pdf_page_from_image(
visible_image_out, page_context, orientation_correction
)
+7 -5
View File
@@ -276,17 +276,19 @@ def filter_page_image(page: PageContext, image_filename: Path) -> Path:
If the return value is a file that does not exist, ``FileNotFoundError``
will occur. The return value should be a path to a file in the same folder
as ``image_filename``.
Implementation detail: If the value returned is falsy, OCRmyPDF will ignore
the return value and assume the input file was unmodified. This is deprecated.
To leave the image unmodified, ``image_filename`` should be returned.
as ``image_filename``. To leave the image unmodified, ``image_filename``
should be returned.
Note:
This hook will be called from child processes. Modifying global state
will not affect the main process or other child processes.
Note:
This is a :ref:`firstresult hook<firstresult>`.
.. versionchanged:: 14.0
Previously, OCRmyPDF would treat as a falsy value as a request to leave
the image unmodified. This is no longer supported and will trigger an
exception.
"""