使用Python将PDF转换为一系列图像 [英] Converting a PDF to a series of images with Python

查看:145
本文介绍了使用Python将PDF转换为一系列图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用Python将多页PDF转换为一系列JPEG。我可以使用可用的工具轻松地将PDF分割成单独的页面,但是我无法找到任何可以将PDF转换为图像的内容。

I'm attempting to use Python to convert a multi-page PDF into a series of JPEGs. I can split the PDF up into individual pages easily enough with available tools, but I haven't been able to find anything that can covert PDFs to images.

PIL没有工作,因为它无法阅读PDF。我发现的两个选项是通过shell使用GhostScript或ImageMagick。这对我来说不是一个可行的选择,因为这个程序需要跨平台,我不能确定这些程序是否可以安装和使用它们的机器上。

PIL does not work, as it can't read PDFs. The two options I've found are using either GhostScript or ImageMagick through the shell. This is not a viable option for me, since this program needs to be cross-platform, and I can't be sure either of those programs will be available on the machines it will be installed and used on.

有没有可以做到这一点的Python库?

Are there any Python libraries out there that can do this?

推荐答案

ImageMagick有 Python绑定

ImageMagick has Python bindings.

这篇关于使用Python将PDF转换为一系列图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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