从PDF创建JPG缩略图会导致新版ImageMagick出现问题 [英] Creating JPG thumbnails from PDF causes problems with new version of ImageMagick

查看:202
本文介绍了从PDF创建JPG缩略图会导致新版ImageMagick出现问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Imagemagick使用此命令创建pdf文件的缩略图图像:

I'm using Imagemagick to create thumbnails images of pdf files with this command:

convert 'input.pdf[0]' -resize "100x140>" -colorspace 'rgb' 'output.jpg' 2>/dev/null

有些PDF是在CMYK颜色空间中,因此预期的颜色空间的规范为rgb。这个工作正常,直到我更新到Imagemagick(6.6.7-1)和ghostscript(9.01_0)的最新版本,现在看起来转换为rgb不再工作,这是一个示例输出:

Some of the PDFs are in CMYK color space, hence the specification of the expected -colorspace as rgb. This was working fine until I updated to the latest versions of Imagemagick(6.6.7-1) and ghostscript(9.01_0), now it looks like the conversion to rgb isn't working any longer, here is an example output:

(背景应该是白色,而不是黑色)
似乎问题来自-resize选项,因为如果我删除它,输出是正确的。

(The background should be white, not black) It seems though that the problem comes from the -resize option because if I remove it the output is correct.

为了得到预期的输出我现在做两次传递,第一次转换为rgb,第二次调整图像大小,但这不是很优雅。有没有更好的解决方案?

To get the expected output I now do two passes, the first to convert to rgb and the second to resize the image, but that's not very elegant. Is there a better solution?

推荐答案

我通过传递额外的 -flatten 选项。现在我的缩略图正确渲染。

I solved this problem by passing the extra -flatten option. Now my thumbnails are render correctly.

这篇关于从PDF创建JPG缩略图会导致新版ImageMagick出现问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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