将PDF转换为1920x1080的图像

阿尔里克

我想使用将PDF转换为PNG图像convert图像必须具有?x1080的比例,以适合1920x1080的比例,并具有最佳的质量。

这是我可以与convert一起使用的许多选项:https : //imagemagick.org/script/command-line-options.php#append


  • 首先,我尝试了以下命令行:

convert my.pdf -geometry 1920x1080 -size 1920x1080 -density 1920x1080 my_resized_pdf.png

命令的结果为我提供了具有良好几何形状(763x1080)的图像,但是我不想得到低质量的图像。

在此处输入图片说明

  • 我使用不带geometry参数的convert命令行,如下所示:

convert my.pdf -size 1920x1080 -density 1920x1080 my_resized_pdf.png

结果的质量恰好是我想要的,但分辨率不是1920x1080的比率,而是842x595。它不能完全适合1920x1080比例的高度。

在此处输入图片说明

Is it possible to get PNG images with a ?x1080 ratio and with a 100% quality from a PDF ? Or is 842x595 the biggest ratio to get a 100% quality image ? Should i set a DPI option to convert ?

frostschutz

This involves some trial & error and in the end, it's debatable which result you might consider to be the "best result". So allow me to just give some generic advice:

  • use the -flatten option to get rid of transparent background. The transparency makes it hard to judge actual quality of the result. If you need the transparency in the final image, you can remove -flatten once you're sure of the quality.

  • use something like -density 300 to get a high DPI result. The main issue with convert is that it uses a very low density by default (72 DPI). This parameter has to be specified before the input file.

  • downscaling a high DPI image might cause additional blur, so perhaps calculating the correct DPI value to achieve the desired resolution is the way to go:

    $ convert -density 100 file.pdf -flatten file100.png
    $ file file100.png
    file100.png: PNG image data, 827 x 1169, 8-bit colormap, non-interlaced
    $ echo $((1080*10000/1169))
    9238
    $ convert -density 92.38 file.pdf -flatten file9238.png
    $ file file9238.png
    file9238.png: PNG image data, 764 x 1080, 8-bit colormap, non-interlaced
    

I'm not sure if there is a way to have convert determine "ideal" DPI value by itself.

If you take this question to the ImageMagick IRC channel or forum, I'm sure you'd get some more advice. It helps if you provide the link to the PDF file you're working with. ;)

您还可以通过其他方式提高质量,例如通过修剪掉空白边框。如果页面的一半是白色,则会损失很多分辨率。甚至有重新包装PDF文本以充分利用可用屏幕空间的解决方案(例如k2pdfopt)。

最后,也尝试其他程序。这是一个见解,但我更喜欢直接使用Inkscape或GhostScript。ImageMagick具有“粘合在一起”的字符,Inkscape具有更平衡的结果,并且GhostScript允许您渲染无模糊的纯像素图像(如果您喜欢的话-pngalpha用于模糊版本,实际上与相同convert)。

ImageMagick:

图像魔术

墨迹:

墨迹

GhostScript:

gs -r92.38 -sDEVICE=png48 -sOutputFile=ghostscript.png file.pdf

GhostScript

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

将1920x1080编码为edid格式

来自分类Dev

Google Chrome 1920x1080问题?

来自分类Dev

psd 转 html 1920X1080

来自分类Dev

使用 OpenCV 以 15mp 捕获 1920x1080 图像

来自分类Dev

非最佳模式推荐模式1920x1080

来自分类Dev

屏幕分辨率回落到1920x1080

来自分类Dev

如何以1920x1080的高分辨率优化图像以使其成为背景?

来自分类Dev

如何以1920x1080的高分辨率优化图像以使其成为背景?

来自分类Dev

将图像转换为pdf

来自分类Dev

如何在1920x1080视频中使用“标准PAL”标志

来自分类Dev

Win 10无法访问,卡在1920x1080 144Hz

来自分类Dev

1920x1080触摸屏驱动程序(Dell S2240T)

来自分类Dev

分辨率为1920x1080的Yoga 910上闪烁和闪烁的图形

来自分类Dev

FFMPEG:是否可以使用DSHOW录制1920x1080屏幕?

来自分类Dev

在1920x1080显示器中模拟1600x900分辨率

来自分类Dev

我可以用1920x1080的信号驱动2560x1600的显示器吗?

来自分类Dev

无法在Xenserver Windows 7 guest虚拟机上使用1920x1080分辨率

来自分类Dev

升级将不允许第二台显示器转到1920x1080

来自分类Dev

FFmpeg以除1920x1080以外的任何分辨率从uvc / dev / video0捕获

来自分类Dev

在Windows 8中的1920x1080 IPS显示器上,某些程序中的字体看起来模糊

来自分类Dev

将PDF转换为图像(格式正确)

来自分类Dev

使用Python将PDF转换为图像

来自分类Dev

将TIFF图像批量转换为PDF?

来自分类Dev

将PDF转换为图像的快速方法

来自分类Dev

将pdf转换为图像[jpeg | png]

来自分类Dev

使用图像将.md转换为.pdf

来自分类Dev

使用 PdfBox 将 Pdf 转换为图像

来自分类Dev

WinRt将PDF转换为图像以提高图像质量

来自分类Dev

将 html 图像转换为 pdf(图像未显示)- selectpdf

Related 相关文章

热门标签

归档