cpdf -extract-images in.pdf [<range>] [-im <path>] [-p2p <path>] [-dedup | -dedup-perpage] -o <path>
cpdf -image-resolution <minimum resolution> in.pdf [<range>]
Cpdf can extract the raster images to a given location. JPEG and JPEG2000 images are extracted directly. Other images are written as PNGs, processed with either ImageMagick’s “magick” command, or NetPBM’s “pnmtopng” program, whichever is installed. JBIG2 image extraction is not yet supported.
cpdf -extract-images in.pdf [<range>] [-im <path>] [-p2p <path] [-dedup | -dedup-perpage] -o <path>
The -im or -p2p option is used to give the path to the external tool, one of which must be installed. The output specifer, e.g -o output/%%% gives the number format for numbering the images. Output files are named serially from 0, and include the page number too. For example, output files might be called output/000-p1.jpg, output/001-p1.png, output/002-p3.jpg etc. Here is an example invocation:
cpdf -extract-images in.pdf -im magick -o output/%%%
The output directory must already exist. The -dedup option deduplicates images entirely; the -dedup-perpage option only per page.
To list all images in the given range of pages which fall below a given resolution (in dots-per-inch), use the -image-resolution function:
cpdf -image-resolution 300 in.pdf [<range>]
To remove a particular image, find its name using -image-resolution with a sufficiently high resolution (so as to list all images), and then apply the -draft and -draft-remove-only operations from Section 19.1.