GithubHelp home page GithubHelp logo

python-keynote's Introduction

python-keynote

python-keynote contains keynote_api a very simple Apple Keynote 09 file reader.

My current goal was to read all the pictures out of a keynote file and figure out their sizes. I wrote enough to do that but tried to keep it general. I hope to expand on it later but thought I would publish what I had now.

I hope that maybe 4 people find this handy. ;-)

It only works on Apple Keynote 09 files.

I wrote this on Python 2.7 and know it at least works there.

The idea is to present a Keynote file as series of nested Python objects. keynote_api contains three classes and a few helper functions.

  • keynote: The keynote document object. It contains slides.
  • slide: The slide object is really only useful to group pictures.
  • picture: The picture object holds sizing and position information.

Here is a code snippet that demonstrates the library. It is included as a working program, keynote-info.py, in the examples directory.

keynote = Keynote(keynote_file)
print("Keynote Size: %sx%s" % (keynote.width, keynote.height))
print("Number of slides: %s" % len(keynote.slides))
for i, slide in enumerate(keynote.slides):
    print("Slide %s: %s" % (i, slide.id))
    for j, picture in enumerate(slide.pictures):
        print("    Picture %s : %s" % (j, picture.relative_path))
        print("        natural_width  : %s" % picture.natural_width)
        print("        natural_height : %s" % picture.natural_height)
        print("        display_width  : %s" % picture.display_width)
        print("        display_height : %s" % picture.display_height)
        print("        display_x      : %s" % picture.display_x)
        print("        display_y      : %s" % picture.display_y)
        picture.export(".")
        print("Picture saved")

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.