How to convert a .PDF file to .PNG using Image Magick

ImageMagick is a powerfull tool to manipulate images. If you want to convert a .PDF to an .PNG file use the following command:

convert -verbose -density 300 -trim input.pdf -quality 100 -sharpen 0x1.0 -background white -flatten output.png

Assuming that your pdf is called “input.pdf” and consists only of one page. The above command colors any transparent background white.

(via stackoverflow.com and imagemagick.org)