code: def add_options(parser):
      optimizing = parser.add_argument_group(
          "Optimization options",
          "Control how the PDF is optimized after OCR",
      )
      optimizing.add_argument(
          "-O",
          "--optimize",
          type=int,
          choices=range(0, 4),
          default=1,
          help=(
              "Control how PDF is optimized after processing:"
              "0 - do not optimize; "
              "1 - do safe, lossless optimizations (default); "
              "2 - do lossy JPEG and JPEG2000 optimizations; "
              "3 - do more aggressive lossy JPEG and JPEG2000 optimizations. "
              "To enable lossy JBIG2, see --jbig2-lossy."
          ),
      )
      optimizing.add_argument(
          "--jpeg-quality",
          type=numeric(int, 0, 100),
          default=0,
          metavar="Q",
          help=(
              "Adjust JPEG quality level for JPEG optimization. "
              "100 is best quality and largest output size; "
              "1 is lowest quality and smallest output; "
              "0 uses the default."
          ),
      )
      optimizing.add_argument(
          "--jpg-quality",
          type=numeric(int, 0, 100),
          default=0,
          metavar="Q",
          dest="jpeg_quality",
          help=argparse.SUPPRESS,  # Alias for --jpeg-quality
      )
      optimizing.add_argument(
          "--png-quality",
          type=numeric(int, 0, 100),
          default=0,
          metavar="Q",
          help=(
              "Adjust PNG quality level to use when quantizing PNGs. "
              "Values have same meaning as with --jpeg-quality"
          ),
      )
      optimizing.add_argument(
          "--jbig2-lossy",
          action="store_true",
          help=(
              "Enable JBIG2 lossy mode (better compression, not suitable for some "
              "use cases - see documentation). Only takes effect if --optimize 1 or "
              "higher is also enabled."
          ),
      )
      optimizing.add_argument(
          "--jbig2-page-group-size",
          type=numeric(int, 1, 10000),
          default=0,
          metavar="N",
          # Adjust number of pages to consider at once for JBIG2 compression
          help=argparse.SUPPRESS,
      )
      optimizing.add_argument(
          "--jbig2-threshold",
          type=numeric(float, 0.4, 0.9),
          default=0.85,
          metavar="T",
          help=(
              "Adjust JBIG2 symbol code classification threshold "
              "(default 0.85), range 0.4 to 0.9."
          ),
      )
  
file_path: OCRmyPDF/src/ocrmypdf/builtin_plugins/optimize.py
imports: from __future__ import annotations
  import argparse
  import logging
  from collections.abc import Sequence
  from pathlib import Path
  from ocrmypdf import Executor, PdfContext, hookimpl
  from ocrmypdf._exec import jbig2enc, pngquant
  from ocrmypdf._pipeline import get_pdf_save_settings
  from ocrmypdf.cli import numeric
  from ocrmypdf.optimize import optimize
  from ocrmypdf.subprocess import check_external_program
label_desc: Use image node_id 1 for calling a global function with example usage: add_options(parser) without return types