将 PDF 转换为高分辨率图像 [英] Convert PDF to image with high resolution
问题描述
我正在尝试使用命令行程序 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
结果是左图.将此与我的原始命令的结果进行比较(右侧的图像):
(为了真的看到并欣赏两者之间的差异,右键单击每个并选择在新标签中打开图像...".)
还要记住以下事实:
- 右侧更糟糕的模糊图像的文件大小为 1.941.702 字节(1.85 兆字节).其分辨率为 3060x3960 像素,使用 16 位 RGB 色彩空间.
- 左侧更好、更清晰的图像的文件大小为 337.879 字节(330 KB).其分辨率为 758x996 像素,使用 8 位灰度色彩空间.
所以,不需要调整大小;添加 -密度
标志.密度值 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屋!