【发布时间】:2015-02-26 05:10:57
【问题描述】:
我正在尝试使用 this 博客文章将一个 pdf 转换为 jpg,但是每次我尝试运行这个简单的脚本时,我都会收到这个异常 wand.exceptions.WandError: wand contains no images MagickWand-56' @ error/magick-image.c/MagickWriteImage/13001
from wand.image import Image
with Image(filename="myFile.pdf") as img:
img.save(filename="myFile.png")
我正在使用最新版本的 Wand 和 Python 3.4.2。我唯一能想到的可能是版本兼容性问题。
【问题讨论】:
-
我自己在 Ubuntu 14.04 x64 和 python 3.4.1 上测试了这个例子,它可以工作。您确定“myFile.pdf”确实存在吗?也许它的路径或文件名错误?
-
是的。我使用了完整路径、相对路径和文件名。同样的错误。
-
你检查过不同的pdf吗?可能此 pdf 已损坏,或者不是普通的(例如某些安全规则或其他)。
-
可能会丢失一些库。你使用linux/windows/mac吗?检查 pdf 需要什么?鬼脚本可能吗?
-
就是这样。跑
brew install ghostscript,它奏效了。谢谢!
标签: python python-3.x imagemagick wand