You may sometimes want to convert a PDF file into an image format like PNG or JPG. Doing this is easy using the convert application from ImageMagick.
If you do not have it, first install ImageMagick:
$ sudo apt install imagemagick
To convert a PDF with a single page into a JPG:
$ convert foo.pdf foo.jpg $ ls foo.pdf foo.jpg
If the PDF has multiple pages, one image file is produced per page:
$ convert foo.pdf foo.png $ ls foo.pdf foo-1.png foo-2.png foo-3.png
By default, the image file is produced at 96 DPI resolution of the PDF. If you need higher DPI, use the density option. For example, to generate at 300 DPI:
$ convert -density 300 foo.pdf foo.png
-density parameter has to come first. If you place it anywhere else, the program runs silently without complaining, but the output image will be in the default DPI.
Tried with: ImageMagick 6.7.7-10 and Ubuntu 14.04