gpt4 book ai didi

pdf - ImageMagick PDF 到 JPG 有时会导致黑色背景

转载 作者:行者123 更新时间:2023-12-02 09:02:47 24 4
gpt4 key购买 nike

我有以下内容:

ghostscript-fonts-5.50-24
ImageMagick-6.7.2-1
ghostscript-9.02-1

我使用它为每个页面创建一系列 JPG:

convert -density 175 -colorspace sRGB test.pdf -resize 50% -quality 95 test.jpg

当我在 Windows 计算机上运行此程序时,一切似乎都工作正常,但在我们的 Linux 服务器上,我们遇到了黑色背景问题。

生成的 JPG 具有黑色背景,导致图像无法读取,我缺少什么或者我应该采取什么措施来纠正这个问题?

我已经在 Google 上搜索了好几天,但每个建议似乎都不适合我。

非常感谢任何帮助,提前致谢:)

编辑

在转换产生黑色背景的 PDF 之一时刚刚注意到此输出:

**** Warning: Fonts with Subtype = /TrueType should be embedded.
The following fonts were not embedded:
Arial
Arial,Bold
Arial,BoldItalic
**** This file had errors that were repaired or ignored.
**** The file was produced by:
**** >>>> Microsoft« Word 2010 <<<<
**** Please notify the author of the software that produced this
**** file that it does not conform to Adobe's published PDF
**** specification.

这似乎相关,但由于我们无法控制 PDF 的生成方式,因此我们需要某种方法来修复此服务器端。

再次感谢

最佳答案

今天遇到这个,发现了这个:

https://www.imagemagick.org/discourse-server/viewtopic.php?t=20234

基于此,这些都应该有效:

  • -展平
  • -alpha 扁平化
  • -alpha 删除

我目前正在将以下内容用于我的具体案例,效果很好:

convert -thumbnail "1280x800>" -density 300 -background white -alpha remove in.pdf out.jpg

关于pdf - ImageMagick PDF 到 JPG 有时会导致黑色背景,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10934456/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com