pdfimages can extract embedded images from a PDF.
It will not convert a whole PDF page to an image.
It's included in Xpdf tools or Poppler utils.
This is useful if the PDF contains text and images, and you want only the images. Also, it will extract the images in their original format, so no loss of quality is involved (unlike programs which render the whole page and then convert it to e.g. JPEG).
List all images from mydocument.pdf
:
pdfimages -list mydocument.pdf
Extract all images from PDF mydocument.pdf
to individual files named mydocument-image-0000.jpg
, mydocument-images-0001.jpg
and so on:
pdfimages -j mydocument.pdf mydocument-image
Option -j
makes it write embedded JPEG-compressed images as JPEG files, not as PBM/PGM/PPM files (which are uncompressed and huge). Note that images may still be written as PBM/PGM/PPM files, if that's how they were stored in the PDF input file.
If you're using Poppler I recommend replacing it with -all
to
write JPEG, JPEG2000, JBIG2, and CCITT images in their native format. CMYK files are written as TIFF files. All other images are written as PNG files.