pdfimagemagick

Convert PDF to image with high resolution


I'm trying to use the command line program convert to take a PDF into an image (JPEG or PNG). Here is one of the PDFs that I'm trying to convert.

I want the program to trim off the excess white-space and return a high enough quality image that the superscripts can be read with ease.

This is my current best attempt. As you can see, the trimming works fine, I just need to sharpen up the resolution quite a bit. This is the command I'm using:

convert -trim 24.pdf -resize 500% -quality 100 -sharpen 0x1.0 24-11.jpg

I've tried to make the following conscious decisions:

Any suggestions please on getting the resolution of the image in the final PNG/JPEG higher would be greatly appreciated!


Solution

  • It appears that the following works:

    convert           \
       -verbose       \
       -density 150   \
       -trim          \
        test.pdf      \
       -quality 100   \
       -flatten       \
       -sharpen 0x1.0 \
        24-18.jpg
    

    It results in the left image. Compare this to the result of my original command (the image on the right):

      

    (To really see and appreciate the differences between the two, right-click on each and select "Open Image in New Tab...".)

    Also keep the following facts in mind:

    So, no need to resize; add the -density flag. The density value 150 is weird -- trying a range of values results in a worse looking image in both directions!