Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have requirement of converting PDF pages to images. There is a background image with some text written, so when I save this as image only background image got saved.

Is there any software available for the same so that complete page can be converted to image?

share|improve this question
    
What if I want to convert a multipage pdf to a multipage tif file? –  To Do Nov 26 '12 at 14:03

7 Answers 7

up vote 35 down vote accepted
  1. Install imagemagickInstall imagemagick

  2. Using a terminal where the pdf is located:

    convert -density 150 input.pdf -quality 90 output.png
    

    whereby:

    • PNG, JPG or (virtually) any other image format can be chosen
    • -density xxx will set the dpi to xxx (common are 150 and 300)
    • -quality xxx will set the compression to xxx for PNG, JPG and MIFF file formates (100 means no compression)
    • all other options (such as trimming, grayscale, etc) can be viewed on the website of Image Magic.
share|improve this answer
12  
A simple convert creates really shitty quality for me. Use pdftoppm (thanks to enzotib below!). –  dAnjou Jan 9 '13 at 0:17
    
The answer as is does work but the resolution is very poor. Therefore not currently an answer that is useful. Maybe if convert has some parameters that can be specified this could change. –  Elijah Lynn Jan 16 at 19:57
2  
This answer is much higher quality askubuntu.com/a/50180/11929 –  Elijah Lynn Jan 16 at 20:06
    
You can change the density by adding the -density 300 parameter –  run Apr 1 at 12:18

In the poppler-utils packages there is the utility pdftoppm capable of converting pages from a pdf file to ppm, png or jpeg format:

pdftoppm -png file.pdf prefix

will produce prefix-01.png etc. for each page. By default the resolution is 150dpi. Increase the resolution (for higher quality output) as follows:

pdftoppm -rx 300 -ry 300 -png file.pdf prefix

To print only one page, use

pdftoppm -f N -singlefile -png file.pdf prefix

where N is the page number, beginning with 1.

share|improve this answer
1  
Thank you so much. Much better quality than with imagemagick or graphicsmagick! –  dAnjou Jan 9 '13 at 0:18
1  
pdftoppm is much faster than convert –  zuo Nov 6 '13 at 4:52
3  
This is so great! +1 –  Ionică Bizău Jun 6 '14 at 11:38
    
with only one pdf in a folder the specific name of the pdf file is not needed: pdftoppm -png *.pdf prefix –  cipricus Nov 10 '14 at 13:36
1  
Can't belive how easy it was! And the package is already installed by default! Loved it. THANKS! –  Rosamunda May 11 at 18:04

IIRC GIMP is capable of using PDFs, i.e. converting them into images. So if you want to edit the images right away - GIMP is your friend.

share|improve this answer

You can use convert and specify a higher density using -density option.

eg. convert -d 300 foo.pdf bar.png

share|improve this answer
    
can you explain more about what is density and what It can do? –  Raja Jul 24 '14 at 4:03
1  
@AgentCool It specifies the horizontal and vertical image density (in ppi). –  Arjun Jul 27 '14 at 10:02

To get a single page from gm convert, add [N] (with N the page number starting at 0) to the PDF name, ie gm convert foo.pdf[11] out.png to get the 12th page from the PDF.

For pdftoppm use -f N -singlefile, where N is the page number starting at 1, ie pdftoppm -f 12 -singlefile foo.pdf out for the same result. It appears to always add ".png" to the output filename and there is no way to stop this.

share|improve this answer

Master PDF Editor (ver 2.2) has this option buit in. Open the PDF file and then go to File> Export to> Images. It presents a dialog where you can define different options for the output. Extremely useful. Hope this info helps.

share|improve this answer

If you only want to convert a specific page of a PDF to a PNG, you can pipe pdftk to convert (described above) like this:

pdftk document.pdf cat 12 output - | convert - document-page-12.png
share|improve this answer

protected by Community Apr 18 at 0:39

Thank you for your interest in this question. Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.