13

I want to convert a powerpoint presentation to multiple images. I already installed LibreOffice on my server and converting docx to pdf is no problem. pptx to pdf conversion does not work. I used following command line:

libreoffice --headless --convert-to pdf filename.pptx

Is there es way to convert pptx to pngs immediately or do I have to convert it to pdf first and then use ghostscript or something?

And what about the quality settings? Is there a way to choose the resolution of the resulting images?

Thanks in advance!

EDIT: According to this link I was able to convert a pdf to images with the simple command line:

convert <filename>.pdf <filename>.jpg 

(I guess you need LibreOffice and ImageMagick for it but not sure about it - worked on my server)

But there are still the problems with the pptx-to-pdf convert.

Thanks to googling and Sebastian Heyn's help I was able to create some high quality images with this line:

convert -density 400 my_filename.pdf -resize 2000x1500 my_filename%d.jpg

Please be patient after using it - you still can type soemthing into the unix console but it's processing. Just wait a few minutes and the jpg files will be created.

For further information about the options check out this link

P.S.: The aspect ratio of a pptx file doesn't seem to be exactly 4:3 because the resulting image size is 1950x1500

Community
  • 1
  • 1
user2718671
  • 2,866
  • 9
  • 49
  • 86
  • The aspect ration of a PPTX file will depend on the PPTX file itself. It can be pretty much anything. The default for older versions of PPT has always been 10" x 7.5", or 1.3333... rather than the 1.3 aspect ratio you're seeing. The PPTX might be set up at a non-standard size though. – Steve Rindsberg Feb 03 '14 at 19:07
  • Ah ok, I was expecting 4:3 because it always looked like that and most beamers have just a resolution of 800x600 (4:3). Good to know. Thx! – user2718671 Feb 04 '14 at 09:31

3 Answers3

12

After Installing unoconv and LibreOffice you can use:

unoconv --export Quality=100 filename.pptx filename.pdf 

to convert your presentation to a pdf. For further options look here.

Afterwards you can - as already said above - use:

convert -density 400 my_filename.pdf -resize 2000x1500 my_filename%d.jpg 

to receive the images.

user2718671
  • 2,866
  • 9
  • 49
  • 86
7

Convertion PPTX to PNG/JPG

This solution requires LibreOffice ( soffice ) and Ghostscript ( gs )

sudo apt install libreoffice ghostscript

Then two steps:

  1. PPTX -> PDF
soffice --headless --convert-to pdf prezentacja.pptx
  1. PDF -> PNG/JPG
gs -sDEVICE=pngalpha -o slajd-%02d.png -r96 prezentacja.pdf
  • -o slajd-%02d.png - output to file, %02d slajd number, two digits
  • -r96 - resolution:
    • 96 -> 1280x720
    • 144 -> 1920x1080
Community
  • 1
  • 1
NiKO
  • 2,610
  • 1
  • 19
  • 19
1

Not sure about libreoffice, but afaik its the only program to deal with pptx files.

I found this http://ask.libreoffice.org/en/question/23851/converting-pptx-to-pdf-issue/

If you have pdfs you can use imagemagick to output any quality pictures

Sebastian Heyn
  • 387
  • 3
  • 15
  • Thanks! I figured out how to convert pdf to jpgs. Now I just have to find out how to convert pptx to pdf and how to change the quality settings. Maybe your link is the answer to the pptx to pdf question :) – user2718671 Feb 03 '14 at 09:41
  • 1
    convert allows to add quality settings convert -density 400 file.pdf -scale 2000x1000 hi-res%d.jpg – Sebastian Heyn Feb 03 '14 at 10:19
  • Yeah thx, I was already trying. But it's strange. The one option that worked was resize 250% but the images were blurry of course. I tried density, resample etc. but the console doesn't really react to it. I still can press enter and if I press the left arrow ^[[D appears. After pressing ctrl+c+enter I finally can use commands again. But no jpgs were created. It's really weird :( But convert -density 400 MP.pdf -scale 2000x1500 hi-res%d.jpg should be the correct syntax... – user2718671 Feb 03 '14 at 10:40
  • Alright It works now. I was just too impatient. Normally you can't do anything in the Unix console while processing. But after the convert command line I could - Confusing but it worked :D – user2718671 Feb 03 '14 at 11:01