Megalextoria
Retro computing and gaming, sci-fi books, tv and movies and other geeky stuff.

Home » Digital Archaeology » Digital Archaeology » Extract images from PDF (Linux)
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Extract images from PDF (Linux) [message #301823] Tue, 06 October 2015 09:43 Go to next message
CyberkNight is currently offline  CyberkNight
Messages: 1503
Registered: July 2012
Karma: 0
Senior Member
To extract images in jpg format from a PDF file, use the following command:

pdfimages -j /Documents/SampleWithImages.pdf /Documents/ExtractedImages/image


See http://www.howtogeek.com/228796/how-to-extract-and-save-imag es-from-a-pdf-file-in-linux/ for more info and examples.


Re: Extract images from PDF (Linux) [message #330475 is a reply to message #301823] Fri, 14 October 2016 17:05 Go to previous messageGo to next message
CyberkNight is currently offline  CyberkNight
Messages: 1503
Registered: July 2012
Karma: 0
Senior Member
If the images need rotating, you can use convert:

for file in *.jpg; do convert $file -rotate 180 $file; done


The above example rotates all of the *.jpg images in the current directory by 180 degrees.


Re: Extract images from PDF (Linux) [message #370658 is a reply to message #330475] Fri, 13 July 2018 10:15 Go to previous messageGo to next message
CyberkNight is currently offline  CyberkNight
Messages: 1503
Registered: July 2012
Karma: 0
Senior Member
Sometimes using pdfimages results in multiple images per page depending on how the PDF was originally created. If you are looking for one image per page and pdfimages does not give that to you, you can use convert instead:

convert -density 300 input.pdf output.jpg


The "-density" switch controls the dpi.


[Updated on: Fri, 13 July 2018 10:16]

Report message to a moderator

Re: Extract images from PDF (Linux) [message #394696 is a reply to message #370658] Tue, 19 May 2020 10:19 Go to previous message
CyberkNight is currently offline  CyberkNight
Messages: 1503
Registered: July 2012
Karma: 0
Senior Member
And one more example using convert since this is my most common use case:

 convert -scene 1 -density 300 document.pdf document_%03d.jpg


This example uses -density the same as above but also uses "-scene 1" to start the page numbering at 1 and "%03d" to make all numbers three digits (e.g. document_001.jpg, document_002.jpg, etc.)


  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Convert RAW to JPG in Mac terminal
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Thu Jul 09 04:13:59 EDT 2020

Total time taken to generate the page: 0.00376 seconds