将PDF转换为高分辨率的图像 [英] Convert PDF to image with high resolution

查看:405
本文介绍了将PDF转换为高分辨率的图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用命令行程序 convert 将PDF转换为图像(JPEG或PNG)。这是其中一个PDF 我正在尝试转换。

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:


  • 调整大小(对分辨率没有影响)

  • 使质量尽可能高

  • 使用 -sharpen (我尝试了一系列值)

  • resize it larger (has no effect on the resolution)
  • make the quality as high as possible
  • use the -sharpen (I've tried a range of values)

任何有关在最终PNG / JPEG中获得图像分辨率的建议都将非常感谢!

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

推荐答案

看来以下情况有效:

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):

   ;

  

(至 真的 查看并欣赏两者之间的差异,右键单击每个,然后选择在新标签中打开图像...。)

同时请记住以下事实:


  • 右边较差的模糊图像有文件大小为1.941.702字节(1.85 MByte)。
    它的分辨率是3060x3960像素,使用16位RGB色彩空间。

  • 左边更好,更清晰的图像文件大小为337.879字节(330 kByte)。
    它的分辨率为758x996像素,使用8位灰色空间。

因此,无需调整大小;添加 -density 标志。密度值150很奇怪 - 尝试一系列值会导致两个方向上看起来更糟糕的图像!

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!

这篇关于将PDF转换为高分辨率的图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆