Convert PDF to image with high resolution

前端 未结 18 2033
故里飘歌
故里飘歌 2020-11-28 00:13

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 progr

18条回答
  •  暗喜
    暗喜 (楼主)
    2020-11-28 00:39

    In ImageMagick, you can do "supersampling". You specify a large density and then resize down as much as desired for the final output size. For example with your image:

    convert -density 600 test.pdf -background white -flatten -resize 25% test.png
    


    Download the image to view at full resolution for comparison..

    I do not recommend saving to JPG if you are expecting to do further processing.

    If you want the output to be the same size as the input, then resize to the inverse of the ratio of your density to 72. For example, -density 288 and -resize 25%. 288=4*72 and 25%=1/4

    The larger the density the better the resulting quality, but it will take longer to process.

提交回复
热议问题