Extract images from a PDF document

27 January, 2008 - 20:06

When you want to extract a bitmap image from a PDF document, it is tempting to do the "print screen" trick. The drawback of this approach is that you'll inevitably lose quality: the image pixels will typically not map to your screen's pixels in a one to one fashion because of the decimation/resampling/scaling (or even rotation) when viewing the PDF document.

There are probably a lot of tools extract the bitmap image correctly out there. I guess this functionality is built in in Adobe Acrobat reader. But if you're in my situation (no desire to use Adobe's bloat) or you just need a small handy command line tool for linux (or other "unixes"): try pdfimages. It's part of the xpdf package, which is probably available for all major linux distributions.

Usage is very straightforward:

pdfimages -j foo.pdf  bar

This will extract all images from foo.pdf and save them in JPEG format (option -j) to bar-000.jpg, bar-001.jpg, bar-002.jpg, etc.

Inspired by http://www.boekhoff.info/?pid=linux&tip=extract-images-from-pdf-files

5 December, 2011 - 11:55

great dude

Gregory (not verified)

Thanks for this post, i saved a time searching for this stuffs, respect, Gregory cheers

28 November, 2011 - 16:13

I had no idea the images were

power wheels jeep (not verified)

I had no idea the images were embedded no wonder I could never get it right thanks

22 November, 2011 - 17:13

Thanks for the post. I found

Ilya (not verified)

Thanks for the post. I found it 3rd on the Google results and immediately knew that's what I needed :)

8 October, 2011 - 15:12

Muchos Grasias

BarX (not verified)

Thanks to your post I've resolved my problem in time =)

29 July, 2011 - 22:42

Thanks so much, the command

Anonymous (not verified)

Thanks so much, the command works fine....

31 March, 2011 - 12:10

I tried this but it cropped

Anonymous (not verified)

I tried this but it cropped the images - maybe the pdf dimesions?

I managed to get them though using Gimp, I love Gimp - it just asks what it should import, you select all and hey presto!!

:)

26 January, 2011 - 04:20

Great tip

SW (not verified)

You save my time. Previouly I used Imagemagick 'convert' to extract the jpg file but result is not good.

30 October, 2010 - 07:40

CrewTom wrote: "That is, the

Anonymous (not verified)

CrewTom wrote:
"That is, the total data size of the extracted images was almost
10-times bigger than the document that they were extracted from.

I'm curious how that can be possible."

I image that's because the software is re-encoding the images. It is probably not just saving them as they're stored in the PDF. I'm looking for some free software for Windows that can save the images at the same quality as they're stored in the PDF file.

2 June, 2010 - 22:46

Right click, save-as under Ubuntu

Darxus (not verified)

The default document viewer in Ubuntu (Lucid) Linux, evince (v2.30.0), now lets you right click on an image and save it to a file, finally.

I checked that again just after trying your tip, which is great for mass extraction, thanks.

31 May, 2010 - 17:40

Thanks for this cool tip, it

Anonymous (not verified)

Thanks for this cool tip, it really works! This is saving me a lot of time!

Post new comment

The content of this field is kept private and will not be shown publicly.
  • No HTML tags allowed
  • Lines and paragraphs break automatically.

More information about formatting options