# `optimize_images` Optimize images ## Usage > pdftl `` `optimize_images` `[...]` `output` `` `[]` ## 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=**`` (default: 75) * **png_quality=**`` (default: 70) * **quality=**`` * Set JPEG and/or PNG quality to ``. * `` 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=**`` (default: 0) * Use parallel processing with `` jobs. * If `` 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](https://pdftl.readthedocs.io/en/stable/operations/optimize_images.html)* *Type: Operation*