ocrmypdf/OCRmyPDF · warning
jbig2_lossy is deprecated and will be ignored. Lossy JBIG2 h
Error message
jbig2_lossy is deprecated and will be ignored. Lossy JBIG2 has been removed due to character substitution risks.
What it means
Lossy JBIG2 encoding was removed from OCRmyPDF due to character substitution risks (lossy JBIG2 can swap visually similar characters). Passing jbig2_lossy=True now only triggers this warning; the option is discarded.
Source
Thrown at src/ocrmypdf/api.py:837
'input_file',
'output_file',
'kwargs',
'plugin_manager',
}
}
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)
View on GitHub (pinned to 5074a0b0e1)
Solutions
- Remove jbig2_lossy from your call — it does nothing now
- Use standard (lossless) JBIG2 if the encoder is available, or accept higher file size
- If size matters, tune jpeg_quality instead for image-only pages
Example fix
# before
ocrmypdf.ocr('in.pdf', 'out.pdf', jbig2_lossy=True)
# after
ocrmypdf.ocr('in.pdf', 'out.pdf') # lossy JBIG2 removed for correctness Defensive patterns
Strategy: validation
Validate before calling
kwargs.pop('jbig2_lossy', None) Prevention
- Remove removed options from shared config dicts after upgrades
- Use lossless compression settings only
When it happens
Trigger: Calling ocrmypdf.ocr(..., jbig2_lossy=True); the argument is popped from create_options_kwargs after warning.
Common situations: Scripts written for older OCRmyPDF versions that supported lossy JBIG2 compression; users chasing smaller file sizes for scanned documents.
Related errors
- jbig2_page_group_size is deprecated and will be ignored.
- ocrmypdf.ocr(jpg_quality=...) is deprecated, use jpeg_qualit
- ocrmypdf.ocr(verbose=) is ignored. Use ocrmypdf.configure_lo
- semfree.py is deprecated and will be removed in a future rel
AI-assisted analysis of ocrmypdf/OCRmyPDF@5074a0b0e1 (2026-08-27).
Data as JSON: /api/errors/14b06780bfd3539b.
Report an issue: GitHub.