{"record":{"id":"6a84505a71e3c698","repo":"ocrmypdf/OCRmyPDF","slug":"ocrmypdf-ocr-jpg-quality-is-deprecated-use-j","errorCode":null,"errorMessage":"ocrmypdf.ocr(jpg_quality=...) is deprecated, use jpeg_quality= instead.","messagePattern":"ocrmypdf\\.ocr\\(jpg_quality=\\.\\.\\.\\) is deprecated, use jpeg_quality= instead\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/ocrmypdf/api.py","lineNumber":463,"sourceCode":"            lang = expanded\n        options_kwargs['languages'] = lang\n    elif 'language' in options_kwargs:\n        del options_kwargs['language']\n\n\ndef _remap_jpg_quality_to_jpeg_quality(options_kwargs: dict) -> None:\n    \"\"\"Map the deprecated 'jpg_quality' parameter to 'jpeg_quality'.\n\n    'jpg_quality' was the original API parameter name. 'jpeg_quality' is the\n    canonical OcrOptions field, matching the primary --jpeg-quality CLI flag.\n    Prefer an explicitly-given 'jpeg_quality' if both are set.\n    \"\"\"\n    if 'jpg_quality' not in options_kwargs:\n        return\n    old_value = options_kwargs.pop('jpg_quality')\n    if old_value is None:\n        return\n    warn(\"ocrmypdf.ocr(jpg_quality=...) is deprecated, use jpeg_quality= instead.\")\n    if options_kwargs.get('jpeg_quality') is None:\n        options_kwargs['jpeg_quality'] = old_value\n\n\ndef create_options(\n    *, input_file: PathOrIO, output_file: PathOrIO, parser: ArgumentParser, **kwargs\n) -> OcrOptions:\n    \"\"\"Construct an options object from the input/output files and keyword arguments.\n\n    Args:\n        input_file: Input file path or file object.\n        output_file: Output file path or file object.\n        parser: ArgumentParser object (kept for compatibility,\n            may be used for plugin validation).\n        **kwargs: Keyword arguments.\n\n    Returns:\n        OcrOptions: An options object containing the parsed arguments.","sourceCodeStart":445,"sourceCodeEnd":481,"githubUrl":"https://github.com/ocrmypdf/OCRmyPDF/blob/5074a0b0e109362422b768fd271ed84bf717c4ec/src/ocrmypdf/api.py#L445-L481","documentation":"Deprecation warning emitted by ocrmypdf.ocr(): the old jpg_quality keyword was renamed jpeg_quality. The value is transparently remapped, so behavior is unchanged — only the name changed.","triggerScenarios":"Calling ocrmypdf.ocr(..., jpg_quality=N) with a non-None value; create_options routes through _remap_jpg_quality_to_jpeg_quality which warns and remaps.","commonSituations":"Upgrading old scripts/tutorials written against pre-rename OCRmyPDF versions; copy-pasted Stack Overflow code.","solutions":["Rename jpg_quality= to jpeg_quality= in your call","Silence during migration with warnings.filterwarnings('ignore', message='.*jpg_quality.*') if needed","Search your codebase for jpg_quality to catch all occurrences"],"exampleFix":"# before\nocrmypdf.ocr('in.pdf', 'out.pdf', jpg_quality=85)\n# after\nocrmypdf.ocr('in.pdf', 'out.pdf', jpeg_quality=85)","handlingStrategy":"validation","validationCode":"opts.pop('jpg_quality', None)  # migrate before calling ocr()","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use current keyword names from the API docs","Grep codebase for deprecated kwargs after major-version upgrades"],"tags":["deprecation","api","rename","jpeg"],"backgroundTag":"deprecated-keyword-argument","analyzedSha":"5074a0b0e109362422b768fd271ed84bf717c4ec","analyzedAt":"2026-08-27T11:57:38.523Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}