This guide collects instructions about extracting and saving images from PDF file. This is possible by using pdfimages command line utility. pdfimages is built-in in Ubuntu along with poppler-utils package. pdfimages can save images in .ppm, .pbm, and .jpg formats.

Extract Images As Is

pdfimages <pdf_file> <name>-nnn 
pdfimages -j <pdf_file> <name>-nnn.jpg
Explanation: the first command will extract images into .ppm or .pbm format. The -nnn addition is a clue for pdfimages to append file number to file name. The second command will do the same for .jpg format.

Extract Images from Particular Pages

pdfimages -f <number> -l <number> <pdf_file> <name>-nnn
pdfimages -j -f <number> -l <number> <pdf_file> <name>-nnn.jpg
Explanation: option -f specifies the first page while -l specifies the last page. If -f 1 and -l 4 being used, then it means images between page 1 and 4 will be extracted.

Append Page Number in Every Image

pdfimages -p <pdf_file> <name>-nnn
pdfimages -j -p <pdf_file> <name>-nnn.jpg
Explanation: option -p will give page number in every corresponding image extracted. It is useful to distinguish between images if they are so many.

, , , ,