How to convert a PDF-file to a PNG-file with the command convert

The program Imagemagick, includes the command convert, which can convert a PDF-file to a PNG-file.

If the image contains text, you need to give instructions on the resolution with which convert should render the text. This is a bit tricky, since the manual of convert is not very clear on this point.

The thing is, that you need to supply this information before you mention the input file on the command-line.

Here's what NOT works:

convert the.image.pdf -density 300 -resize 800x output.png

And here is how to do it:

convert  -density 300 the.image.pdf -resize 800x output.png

Thus, you must specify options for the input file before you mention the input file, or else the options will be applied to the output file. This is not what you would expect from the manual which says:

convert input-file [options] output-file

comments powered by Disqus


Back to the index

Blog roll

R-bloggers, Debian Weekly
Valid XHTML 1.0 Strict [Valid RSS] Valid CSS! Emacs Muse Last modified: oktober 17, 2019