# `delete_images` Delete images ## Usage > pdftl `` `delete_images` `[[spec](params)...]` `output` `` ## Details The `delete_images` operation permanently overwrites images matching specific criteria with a 1x1 transparent pixel. This safely crushes large graphical bloat (like full-page ads) while maintaining strict PDF structural validity. **Global vs. Page-Based:** - **Global (Default):** If you omit the page selector or use `-`, the operation scans the entire internal PDF object table. It will aggressively find and destroy matching images no matter where they hide (including inside annotations, patterns, and background forms). - **Page-Based:** If you provide a specific page range (e.g., `1-5`), it will only scan those specific pages and the forms located on them. *(Note: Because the underlying data is overwritten, if a deleted image on page 1 is also shared on page 10, it will visually disappear from page 10 as well).* The syntax is `[selector](Key=Value, ...)`, where: - `selector` is an optional page range (`1-5`, `odd`, `-`). If omitted, acts globally. - `Key=Value` pairs define the filter criteria an image must meet to be deleted. ### Filter Parameters | Parameter | Description | Example | | :--- | :--- | :--- | | `minbytes` | Min stream size in bytes. Supports `k`, `m`, `g` suffixes. | `100k`, `2m` | | `maxbytes` | Max stream size in bytes. Supports `k`, `m`, `g` suffixes. | `10000`, `1.6m` | | `minpixels` | Min dimensions (`WxH`) OR min total area (single number). | `20x400`, `100k` | | `maxpixels` | Max dimensions (`WxH`) OR max total area (single number). | `1000x1000`, `10m` | | `format` | Substring match against the image filter. | `dct` (JPEG), `flate` (PNG) | *Note: If multiple parameters are provided, an image must meet ALL criteria to be replaced.* ## Examples > Globally scan and destroy any image larger than 500KB anywhere in the document. ``` pdftl in.pdf delete_images '(minbytes=500k)' output out.pdf ``` > On even pages from 1 to 10, destroy images > 100KB with a minimum dimension of 20x400. ``` pdftl in.pdf delete_images '1-10even(minbytes=100k,minpixels=20x400)' output out.pdf ``` > Globally destroy all JPEG (DCTDecode) images. ``` pdftl in.pdf delete_images '(format=dct)' output out.pdf ``` **Tags**: in_place, images, optimization, delete *Source: pdftl.operations.delete_images* *Read online: [https://pdftl.readthedocs.io/en/stable/operations/delete_images.html](https://pdftl.readthedocs.io/en/stable/operations/delete_images.html)* *Type: Operation*