[Image-SIG] massrotate in python

Alexy Khrabrov list+pyim at setup.org
Fri May 21 11:49:33 EDT 2004

Greetings -- I'm faced with the simplest task any digital photographer
needs: rotate vertical jpegs.  There's a program, jpegtran, to do it
losslessly, and with -copy all it also preserves EXIF data.  So I want
to use it instead of lossy rotations in xv, ImageMagick, and the like.

Looking around, I found a perl script to do just that:


Alas, its use of Gtk2 causes major headache when I install all that stuff
and it didn't play together in subtle ways.  And when it comes down to
programming it myself, I use python.

I also found that imlib2 is so much faster than ImageMagick, as
demonstrated by zphoto, an album app with a neat flash gallery.

So I wonder what's the simplest way to put together a python massrotate
script -- basically, see thumbs, and invoke either of the two actions,
rotate clockwise or counterclockwise, on some, which will invoke jpegtran
on them.

Come to think of it, I don't need a buttoning toolkit, I can have key
bindings, like in ImageMagick display, / and \, and look through images
in sequence, like in xv, with <space> -- no GUI per se, just resize an
image to fit the screen for viewing, rotate the original.

Better to have a thumbs gallery, of course, to spot the verticals faster.

So here goes the challenge: small is beautiful!  The massrotate task
does not need a full-blown viewer.  No GUI is necessary, just thumbs and
key bindings and a way to point at a jpeg, then the binding would invoke
a command on it.  What's the simplest way to do it with python?

If by any chance there's a way to define a macro for xv or display,
woould help, too, but the challenge stands!

Alexy Khrabrov :: www.setup.org :: Age Quod Agis

More information about the Image-SIG mailing list