4

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?

Todd Main
  • 28,951
  • 11
  • 82
  • 146
carlosalbertomst
  • 513
  • 6
  • 18

3 Answers3

4

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.

BlairHippo
  • 9,502
  • 10
  • 54
  • 78
  • 1
    +1 for ImageMagick. I'd use PythonMagick (http://wiki.python.org/moin/PythonMagick) (Python bindings on top of the imagemagick API) instead of CLI. – ChristopheD Mar 08 '10 at 20:05
0

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...
Mark
  • 106,305
  • 20
  • 172
  • 230
  • 1
    Not downvoting, but doesn't this require you to install PowerPoint onto your webserver? Seems like a heavy dependency to me (and effectively locking you into Windows as a platform; although you already sort of mentioned that). – ChristopheD Mar 08 '10 at 20:14
  • 1
    @ChirstopheD, yes it would require PowerPoint. Really anything you do though is going to require an application that understands powerpoint PPT files. BlairHippo's solution above mine requires OpenOffice, equally heavy. – Mark Mar 08 '10 at 20:28
0

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

mikerobi
  • 20,527
  • 5
  • 46
  • 42