Convert PDF to image with high resolution

前端 未结 18 1980
故里飘歌
故里飘歌 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:38

    Personally I like this.

    convert -density 300 -trim test.pdf -quality 100 test.jpg
    

    It's a little over twice the file size, but it looks better to me.

    -density 300 sets the dpi that the PDF is rendered at.

    -trim removes any edge pixels that are the same color as the corner pixels.

    -quality 100 sets the JPEG compression quality to the highest quality.

    Things like -sharpen don't work well with text because they undo things your font rendering system did to make it more legible.

    If you actually want it blown up use resize here and possibly a larger dpi value of something like targetDPI * scalingFactor That will render the PDF at the resolution/size you intend.

    Descriptions of the parameters on imagemagick.org are here

提交回复
热议问题