unoconv
is a tool to "convert between any document format supported by OpenOffice," available to install via Homebrew on macOS. You can convert, for instance, ppt
files to png
images (or to a multi-page PDF files) by running a command with this command-line interface program. The project is open source and you can browse its code on GitHub.
brew install unoconv
I ran into this issue when I first ran the unoconv
command.
unoconv
# unoconv: Cannot find a suitable office installation on your system.
# ERROR: Please locate your office installation and send your feedback to:
# http://github.com/dagwieers/unoconv/issues
That's because unoconv
can't find libreoffice
. You can install its Homebrew Cask.
brew install --cask libreoffice
After doing that, unoconv
can find the libreoffice
installation.
unoconv
# unoconv: you have to provide a filename or url as argument
# Try `unoconv -h' for more information.
unoconv slides.pptx -f pdf
Even though you can directly export a PowerPoint presentation to JPEG or PNG format, unoconv
exports only the first page by default.
You can use ImageMagick's convert
tool to rasterize the PDF pages as images.
convert -density 300 slides.pdf image%d.jpg
Here's a bash script that will convert all ppt
presentations in a folder to jpg
images by folders.
# Convert all pptx files to multi-page pdf files
unoconv -f pdf *.pptx
# Loop through pptx files
for f in *.pptx
do
echo "${f}.."
mkdir -p ${f}-jpg
convert -density 20 ${f%.*}.pdf "./${f}-jpg/image%d.jpg"
done
You can see the extensive list of supported input and output formats on unoconv's documentation and read more about how to use unoconv
in its help manual page or by running unoconv -h
.