[Image-SIG] massrotate in python

Chris Barker Chris.Barker at noaa.gov
Thu Jun 3 14:00:00 EDT 2004

Alexy Khrabrov wrote:
> 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.

I have exactly the same need, and I've found a simple solution. I wrote 
a simple python script that uses os.system to call jpegtran to rotate an 
image. (actually I have two, one that rotates clockwise one 
anti-clockwise). I put these into /usr/local/bin.

I use KDE, so I can use konquorer to view a directory that has images in 
  it, and thumbnails are displayed. I have associated the above scripts 
with *.jpeg files, so if I right click on an image, I can click the 
open-with menu, and get a list of apps, including my two rotating 
scripts. It works great.

By the way, I've also got a script that crops an image (using jpegcrop) 
to  a 4X6 aspect ratio and sends it off to the printer.

My long term plan is to add this functionality (and others) to Cornice, 
a wxPython image viewer, but I haven't gotten around to that yet.


It appears you've had problems with wxPython--what system are you 
running, I'm a big fan of wxPython, it should work for you. That's OT 
for this list, though.


Christopher Barker, Ph.D.
NOAA/OR&R/HAZMAT         (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

Chris.Barker at noaa.gov

More information about the Image-SIG mailing list