How to convert PDF to image?
You can use pdftoppm
to convert a PDF to a PNG:
pdftoppm input.pdf outputname -png
This will output each page in the PDF using the format outputname-01.png
, with 01
being the index of the page.
Converting a single page of the PDF
pdftoppm input.pdf outputname -png -f {page} -singlefile
Change {page}
to the page number. It's indexed at 1, so -f 1
would be the first page.
Specifying the converted image's resolution
The default resolution for this command is 150 DPI. Increasing it will result in both a larger file size and more detail.
To increase the resolution of the converted PDF, add the options -rx {resolution}
and -ry {resolution}
. For example:
pdftoppm input.pdf outputname -png -rx 300 -ry 300
Install imagemagick.
Using a terminal where the PDF is located:
For the full document:
convert -density 150 input.pdf -quality 90 output.png
For a single page:
convert -density 150 input.pdf[666] -quality 90 output.png
Whereby:
PNG, JPG or (virtually) any other image format can be chosen.
-density xxx
will set the DPI toxxx
(common are 150 and 300).-quality xxx
will set the compression toxxx
for PNG, JPG and MIFF file formates (100 means no compression).[666]
will convert only the 667th page to PNG (zero-based numbering so[0]
is the 1st page).All other options (such as trimming, grayscale, etc.) can be viewed on the website of Image Magic.
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.