lauantai 18. helmikuuta 2012

Blogging and Images for a Geek



A little funny little piece of New York at the Railway Station of Helsinki: A Grand Central Terminal clock. I used the images of this clock to test the script.

While I enjoy taking photographs a lot their trivial manipulating annoys me: scaling and rotating which usually suffices for a blog post takes a lot of precious time. Modern DSLRs are that good. It makes sense to automatize some of this process and Python spiced with PIL and pyexiv2 is a fine solution.

So what I wanted was just a simple tool which scales the size down and rotates the images according to the EXIF data. Before I had an earlier version of this script I worked like this:

I copied the pictures from my camera to my computer to a directory named like 2012/02/Title of the Post/orig. The pictures are in JPG and RAW formats.
I I hard linked the JPG images from the directory orig to directory cand.
I used Gwenview, a nice KDE image viewer, to select and delete the pictures from the cand directory.
Then I used Gimp to scale and rotate the images. This can be easily done from Gwenview.

But eliminating phases two and four are trivial so let's get to work.

Installation



I'm a unix/linux geek and I use a recent Kubuntu for my everyday computing needs so installing all this software is very straightforward.


0 root@caol-ila:~
# apt-get install python-imaging python-imaging-doc python-imaging-doc-html python-pyexiv2 python-pyexiv2-doc


After a few hours of hacking the code was ready for use. It's a rather typical, compact Python code. It's written for personal use so the testing was pretty slight. If you use it and find bugs I would appreciate email to hauva@iki.fi.

Download.

On the Net



Some market speak for pyexiv2

2 kommenttia:

Ari Makela kirjoitti...
Kirjoittaja on poistanut tämän kommentin.
Ari Makela kirjoitti...

Fixed the silly mistake where sys.stderr.write is used although the perror function exists. I did not post the correction because I did not have the time to test the fix. The mistake does not affect the functionality of the script.