A short post on how to convert PPTX file to images.

Steps

  1. First, we need to install libreoffice:
apt update && apt install libreoffice
  1. Second, we need to install imagemagick:
apt install imagemagick

To convert pptx to image, we need to first convert it to PDF

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

Then we can convert PDF file to image using convert:

convert -density 150 test.pdf -quality 80 output-%3d.jpg

Possible issues

During conversion, two errors occur aftering issuing the convert command:

convert-im6.q16: not authorized `multiple_img.pdf' @ error/constitute.c/ReadImage/412.
convert-im6.q16: no images defined `output-%3d.jpg' @ error/convert.c/ConvertImageCommand/3258.

For the first error, you can 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" />

For the second error, this is because ghostscript has not been installed on the system. Try to install it:

apt install ghostscript

After all these steps, you should be fine to generate from pptx to jpg/png images.

References