carlosalbertomst
carlosalbertomst

Reputation: 513

How do I create a set of image files from a PowerPoint file file?

I'm creating a "slideshow room" web page. The user will upload a PowerPoint file that my server will use to generate a set of .jpg image files representing the slides to present in a custom "gallery viewer".

I'm an experienced Python developer but I cannot find anything useful.

How can I do that?

Upvotes: 4

Views: 3120

Answers (3)

mikerobi
mikerobi

Reputation: 20878

Apache POI and Jython. POI, even has an ImageExtractor class, but having just glanced at the Javadocs, I suspect it is incomplete.

Upvotes: 0

Mark
Mark

Reputation: 108512

Are you doing this on Windows? If so win32 com:

import win32com.client
Application = win32com.client.Dispatch("PowerPoint.Application")
Application.Visible = True
Presentation = Application.Presentations.Open(pathToPPT)
Presentation.Slides[1].Export("C:/path/to/jpg.jpg", "JPG", 800, 600);
etc...

Upvotes: 0

BlairHippo
BlairHippo

Reputation: 9658

Off the top of my head, the way I'd do it:

  1. Use OpenOffice.org to convert the .ppt file into a PDF. (OO.o has a very rich Java API. Rich and bloody difficult to use, mind, but once you figure out how to get it to do the task you need, you're all set. Dunno if you can do anything useful with it via Python; not my language.)
  2. Use ImageMagick to convert the PDF into .jpg files. (Though I've been told converting the PDF into a PS file before turning it into images gives better results.) (IM's command line interface is damn near a language unto itself -- though again, once you figure out how to get it to do what you want, you're all set.)

Dunno if that's the most efficient/reliable way to do it. But fundamentally, I'd be on Google trolling for open-source third party tools that do all the dirty work for me.

Upvotes: 4

Related Questions