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

查看:27
本文介绍了使用 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 绑定.

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

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