Image manipulation with Python

The largest problem in creating a gallery creator is manipulating images; scaling them so that they fit on normal sized screens, creating thumbnails, and extracting interesting EXIF data.

This EXIF library has pretty much the simplest API you could imagine, and just works.

Now to manipulate images. I first went to use the Python Imaging Library (PIL), and after a slightly quirky install (the setup.py script couldn’t run configure and make in a subdirectory for me) it installed OK but I was quickly disappointed. There’s no easy way to scale images down while keeping their aspect ratios correct, and it is slow.

I also looked at a couple of Python wrappers to ImageMagick, one hand written and one SWIG generated. Both of these looked like a pain to install from source, so I haven’t looked at them in depth yet.

So, with a little regret, I’ve fallen back to os.system() calls to ImageMagick’s convert. Hey, it works!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: