以编程方式从 PowerPoint 演示文稿 (.PPT) 中将幻灯片提取为图像

发布于 2024-09-25 09:54:19 字数 1539 浏览 3 评论 0原文

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

她如夕阳 2024-10-02 09:54:19

您或许应该尝试一下 unoconv。根据 手册页,“unoconv 是一个命令行实用程序,可以转换任何文件格式OpenOffice 可以导入到 OpenOffice 能够导出的任何文件格式”

因此,要将 ppt 转换为 png,您可以这样做:

unoconv -f png some-slides.ppt

如果失败,您可以尝试 JODConverterPyODConverter 来自解决问题的艺术。例如,您可以从命令行使用 JODConverter:

java -jar lib/jodconverter-cli-2.2.0.jar document.ppt document.png

You should probably give unoconv a try. According to the man page, "unoconv is a command line utility that can convert any file format that OpenOffice can import, to any file format that OpenOffice is capable of exporting. "

So, to convert ppt to, say, png, you do:

unoconv -f png some-slides.ppt

Should that failed, you may try JODConverter or PyODConverter from Art of Solving. For example, you can use JODConverter from command line:

java -jar lib/jodconverter-cli-2.2.0.jar document.ppt document.png
枕花眠 2024-10-02 09:54:19

鉴于您需要在 Linux 上运行,自动化 OpenOffice.org 可能是最简单的方法。

导出为 HTML 将为您提供 JPEG 或 PNG 图像,每张幻灯片的质量均可配置。

Given your requirement to run on Linux, it's probably easiest to automate OpenOffice.org.

Exporting as HTML will give you a JPEG or PNG image with configurable quality for each slide.

我的奇迹 2024-10-02 09:54:19

如果可以选择使用网络 API,我会尝试 google docs API。您可以上传 ppt 文档,然后以任何支持的格式(包括 pdf 和 png)下载回来。

If using a web API is an option I would try google docs API. You can upload a ppt document and then download it back in any of the supported formats including pdf and png.

ぺ禁宫浮华殁 2024-10-02 09:54:19

Apache POI 是一个 Java 库,但有一个 命令行实用程序,用于将 PPTX 文件转换为 PNG 文件。

要运行它,请在库的二进制下载文件夹的根目录中调用此命令:

java -cp "poi-3.10-FINAL-20140208.jar;poi-ooxml-3.10-FINAL-20140208.jar;poi-ooxml-schemas-3.10-FINAL-20140208.jar;ooxml-lib\dom4j-1.6.1.jar;ooxml-lib\stax-api-1.0.1.jar;ooxml-lib\xmlbeans-2.3.0.jar;lib\commons-codec-1.5.jar;lib\commons-logging-1.1.jar;lib\log4j-1.2.13.jar" org.apache.poi.xslf.util.PPTX2PNG presentation.pptx

它不是 100% 完美 - 我注意到它不喜欢艺术字或从 PowerPoint 中裁剪的图像。

Apache POI is a Java library, but has a command-line utility for converting a PPTX files to PNG files.

To run it, invoke this command inside the root of the library's binary download folder:

java -cp "poi-3.10-FINAL-20140208.jar;poi-ooxml-3.10-FINAL-20140208.jar;poi-ooxml-schemas-3.10-FINAL-20140208.jar;ooxml-lib\dom4j-1.6.1.jar;ooxml-lib\stax-api-1.0.1.jar;ooxml-lib\xmlbeans-2.3.0.jar;lib\commons-codec-1.5.jar;lib\commons-logging-1.1.jar;lib\log4j-1.2.13.jar" org.apache.poi.xslf.util.PPTX2PNG presentation.pptx

It's not 100% perfect--I noticed that it doesn't like WordArt or images that have been cropped from within PowerPoint.

意犹 2024-10-02 09:54:19

几年前,我使用 Impress 的 Slide Splitter 来满足同样的需求。还可以使用 ppt 幻灯片并导出到 .jpeg。

Years ago I used Slide Splitter for Impress for this same exact need. Worked with ppt slides as well and exporting to .jpeg.

倾城泪 2024-10-02 09:54:19

我们可以使用 imagemagick 将 pptx 转换为 pdf,然后将 pdt 转换为 JPEG 图像。这是在 Ubuntu 上对我有用的。

首先我们需要安装几个软件包:

apt update && apt install libreoffice imagemagick ghostscript

现在,使用以下命令将 pptx 文件转换为 PDF:

soffice --headless --convert-to pdf test.pptx

生成的 PDF 文件名为 test.pdf。然后我们可以使用 imagemagick 将 PDF 转换为 jpeg 图像:

# you can tweak density and quality to change the quality of generated images.
convert -density 150 test.pdf -quality 80 output-%3d.jpg

如果您在运行上述命令时遇到错误。编辑 /etc/ImageMagick-6/policy.xml 并将以下行:更改

<policy domain="coder" rights="none" pattern="PDF" />

<policy domain="coder" rights="read|write" pattern="PDF" />

Ref:此答案基于帖子 此处

We can convert pptx to pdf and then pdt to JPEG images using imagemagick. Here is what works for me on Ubuntu.

First we need to install several packages:

apt update && apt install libreoffice imagemagick ghostscript

Now, convert pptx file to PDF using the following command:

soffice --headless --convert-to pdf test.pptx

The generated PDF file is named test.pdf. Then we can use imagemagick to convert PDF to jpeg image:

# you can tweak density and quality to change the quality of generated images.
convert -density 150 test.pdf -quality 80 output-%3d.jpg

In case that you encounter errors when running the above command. Edit /etc/ImageMagick-6/policy.xml and change the following line:

<policy domain="coder" rights="none" pattern="PDF" />

to

<policy domain="coder" rights="read|write" pattern="PDF" />

Ref: This answer is based on post here.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文