optimize_images

Optimize images

Usage

pdftl <input> optimize_images [<optimize_option>...] output <file> [<option...>]

Details

The operation optimize_images optimizes images in a PDF file.

Note: This feature requires ocrmypdf to be installed.

Valid Optimization Options

These options can be passed as arguments following optimize_images.

  • low (aliases: lossless, safe):

    • Apply lossless optimizations only.

  • medium (default; aliases: lossy_medium, lossy):

    • Also allow some lossy optimizations.

  • high (aliases: aggressive, lossy_high):

    • Also allow more aggressive lossy optimizations.

  • jbig2_lossy:

    • Enable JBIG2 lossy mode (see ocrmypdf documentation).

    • This is independent of the preceding options.

  • all (aliases: full):

    • Use all of the above.

  • jpeg_quality=<n> (default: 75)

  • png_quality=<n> (default: 70)

  • quality=<n>

    • Set JPEG and/or PNG quality to <n>.

    • <n> must be an integer between 0 and 100.

    • 0 means use the default quality.

    • 1 is the lowest possible quality.

    • 100 is the highest possible quality.

  • jobs=<n> (default: 0)

    • Use parallel processing with <n> jobs.

    • If <n> is 0, this is set automatically.

Examples

Optimize the images in the file in.pdf

pdftl in.pdf optimize_images output out.pdf

Tags: in_place

Source: pdftl.operations.optimize_images

Read online: https://pdftl.readthedocs.io/en/stable/operations/optimize_images.html

Type: Operation