Skip to content

Graphication on OS X (with pycairo)

I’m working on some visualizations and I want to achieve the look of Last.fm visualization lastgraph3:

wavegraph

The great thing about this is that Andew Godwin, author of the site open sourced the underlying library – Graphication.

Since I’m an OS X user, I decided to make the whole thing work on my system – Leopard 10.5.6 at the time of this writing. Here are the notes, mostly for my reference and because it might be also useful to others:

Get free XCode from Apple: http://developer.apple.com/

First build and install pkg-config from: http://pkgconfig.freedesktop.org/releases/pkg-config-0.23.tar.gz

Then install libpng and libjpeg libraries: http://ethan.tira-thompson.com/Mac%20OS%20X%20Ports.html

Build and install pixman from: http://www.cairographics.org/releases/

Build and install cairo from: http://cairographics.org/releases/

Build and install pycairo from: http://cairographics.org/releases/

Patching:
– you’ll need to edit cairo/Makefile.in file by modifying parameter _cairo_la_LDFLAGS (around line 215) to remove ‘-export-symbols-regex init_cairo’
(thanks Michael Dales)

Build instructions:
– just follow INSTALL file. Essential running:
./configure –prefix=/System/Library/Frameworks/Python.framework/Versions/2.5 (sys.path for my system)
and then make && sudo make install

Now you can finally build and install Graphication package 🙂

All the installations steps are just ./configure && make && sudo make install and just work out of the box. I already have Python PIL installed from sources and I think you need this for one of the steps, but I’m not sure anymore for which one.

After you go through all the steps, you can start drawing something like that:

Simple visualization
Simple visualization

Now to figure out how to create something meaningful with it.

Reblog this post [with Zemanta]

One response to “Graphication on OS X (with pycairo)

Comments are closed.