export_images

Export images and a JSON manifest for external editing

Usage

pdftl <input> export_images [<spec>...] <dir> [output <output>]

Details

The export_images operation extracts all embedded images from the PDF, saves them to a specified directory, and generates a structured JSON manifest file.

This allows you to bulk-export images, edit them in external software (like GIMP or Photoshop), and then easily re-integrate them back into the PDF using the import_images command.

The JSON manifest groups images by their underlying stream data. This means that if a single image is drawn multiple times across different pages, it will only be exported once.

Arguments

  • <directory>: (Required) The directory where the extracted images will be saved.

  • [output <manifest.json>]: The file path to save the JSON manifest. If omitted, the manifest is automatically saved as manifest.json inside the specified directory. Specify output - to print the manifest directly to standard output.

  • [page_range]: Optional page ranges to limit the extraction.

Examples

Extract all images to ‘my_images/’ and save the manifest to ‘my_images/manifest.json’.

pdftl in.pdf export_images my_images

Extract images from pages 1-5 into ‘edited_assets/’ and write manifest to ‘manifest.json’.

pdftl in.pdf export_images 1-5 edited_assets output manifest.json

Tags: info, metadata, images, export

Source: pdftl.operations.export_import_images

Read online: https://pdftl.readthedocs.io/en/latest/operations/export_images.html

Type: Operation