ImageMagick PDF到JPG有时会导致黑色背景 [英] ImageMagick PDF to JPGs sometimes results in black background

查看:1599
本文介绍了ImageMagick PDF到JPG有时会导致黑色背景的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下内容:

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

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

Which I use to create a series of JPGs for each page using:

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

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

When I run this on my windows machine all appears to work ok, but on our linux server we get the black background problem.

生成的JPG有一个黑色背景,使图像不可读,我缺少什么,或者我应该做些什么来纠正这个?

The resulting JPGs have a black background rendering the image un-readable, what am I missing or is there something I should be doing to correct this?

我已经玩了好几天谷歌,但每个建议似乎都不适合我。

I've been all over google for days but each suggestion doesnt seem to work for me.

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

Any help is much appreciated, thanks in advance :)

编辑

转换时注意到此输出其中一个产生黑色背景的PDF:

Just noticed this output when converting one of the PDFs that produces the black background:

**** 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的生成方式,我们需要一些方法修复此服务器端。

This seems related but as we don't have control over how the PDFs are produced we need some way of fixing this server side.

再次感谢

推荐答案

简单修复这个问题是使用支持透明度的图像格式,例如png。

Simple fix to this issue is to use an image format that supports transparency, such as png.

所以:

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

问题解决了:)

这篇关于ImageMagick PDF到JPG有时会导致黑色背景的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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