ocrmypdf/OCRmyPDF · warning

jbig2_page_group_size is deprecated and will be ignored.

Error message

jbig2_page_group_size is deprecated and will be ignored.

What it means

The jbig2_page_group_size option is deprecated and ignored: JBIG2 page-group handling is no longer configurable. The argument is popped from kwargs after the warning.

Source

Thrown at src/ocrmypdf/api.py:843

        create_options_kwargs.update(kwargs)

        parser = get_parser()
        with _plugin_session(plugins, plugin_manager, parser=parser) as plugin_manager:
            if 'verbose' in kwargs:
                warn(
                    "ocrmypdf.ocr(verbose=) is ignored. "
                    "Use ocrmypdf.configure_logging()."
                )

            # Warn about deprecated jbig2 options and remove from kwargs
            if jbig2_lossy:
                warn(
                    "jbig2_lossy is deprecated and will be ignored. "
                    "Lossy JBIG2 has been removed due to character substitution risks."
                )
                create_options_kwargs.pop('jbig2_lossy', None)
            if jbig2_page_group_size:
                warn("jbig2_page_group_size is deprecated and will be ignored.")
                create_options_kwargs.pop('jbig2_page_group_size', None)

            options = create_options(
                input_file=input_file,
                output_file=output_file,
                parser=parser,
                **create_options_kwargs,
            )
            check_options(options, plugin_manager)
            return run_pipeline(options=options, plugin_manager=plugin_manager)


def _pdf_to_hocr(  # noqa: D417
    input_pdf: Path,
    output_folder: Path,
    *,
    language: Iterable[str] | None = None,
    image_dpi: int | None = None,

View on GitHub (pinned to 5074a0b0e1)

Solutions

  1. Remove jbig2_page_group_size from your call
  2. If you need that level of control, run the JBIG2 encoder (jbig2enc) manually in post-processing
  3. Accept library defaults for JBIG2 grouping

Example fix

# before
ocrmypdf.ocr('in.pdf', 'out.pdf', jbig2_page_group_size=8)
# after
ocrmypdf.ocr('in.pdf', 'out.pdf')
Defensive patterns

Strategy: validation

Validate before calling

kwargs.pop('jbig2_page_group_size', None)

Prevention

When it happens

Trigger: Calling ocrmypdf.ocr(..., jbig2_page_group_size=N).

Common situations: Tuned legacy scripts that grouped JBIG2 symbol dictionaries for size/robustness tradeoffs in older releases.

Related errors


AI-assisted analysis of ocrmypdf/OCRmyPDF@5074a0b0e1 (2026-08-27). Data as JSON: /api/errors/557e9f91838bcb39. Report an issue: GitHub.