Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Powerpoint PPT to JPG or PNG Image conversion using PHP

I need to convert single Powerpoint (PPT) slides/files to JPG or PNG format on linux but haven't found any way of doing so successfully so far. I have heard that it can be done with open office via php but haven't found any examples or much useful documentation. I'd consider doing it with python or java also, but I'm unsure which route to take.

I understand that it can be done using COM on a Windows server but would really like to refrain from doing so if possible.

Any ideas/pointers gratefully received. (And yes, I have searched the site and others before posting!)

Thanks in advance,

Rob Ganly

like image 488
Rob Ganly Avatar asked Mar 03 '12 18:03

Rob Ganly


1 Answers

Quick answer (2 steps):

## First converts your presentation to PDF
unoconv -f pdf presentation.ppt
## Then convert your PDF to jpg
convert presentation.pdf presentation_%03d.jpg

And voilá.

Explaning a little more:

I had already follow in the same need. Convert a powerpoint set of slides into a set of images. I haven't found one tool to exactly this. But I have found unoconv which converts libreoffice formats to other formats, including jpg, png and PDF. The only drawback is that unoconv only converts one slide to a jpg/png file, but when converting to PDF it converts the whole presentation to a multiple page PDF file. So the answare were convert the PPT to PDF and with imagemagick's convert, convert the multiple page PDF to a set of images.

Unoconv is distributed within Ubuntu distribution

apt-get install unoconv

And convert is distributed with the imagemagick package

apt-get install imagemagick

In my blog there is an entry about this

like image 194
Filipi Vianna Avatar answered Oct 18 '22 06:10

Filipi Vianna