Extracting images from pdf file from command line in linux

if we want to extract only the images from a pdf file, we can use the command line tool pdfimages. pdfimages extracts the images from the given pdf, from the pages we mention and saves it in the .ppm format. The syntax for using the command is

$ pdfimages -f -l

Image-root is nothing but prefix for the filenames of the image files to be created.

Let us say we have a file by the name temp.pdf, from which we want to extract the images from the pages 2 to 4 assume there are three images.

$ pdfimages -f 2 -l 4 temp.pdf images $ ls image-000.ppm image-001 image-002 temp.pdf

Thus we can see that the three images are extracted and stored as image-000.ppm,image-001.ppm,image-002.ppm.

If the file is password locked we can pass the password using the option -upw along with the command.

Tags: ,
Copyright 2017. All rights reserved.

Posted January 11, 2013 by Tux Think in category "Linux