Here is a little something for your blog…

This was the title of an email I got the other day. The email comes from Michael Baranov, a fellow Pentaxian from Ottawa – a good man, if you ask me 🙂 .

Attached was a Python script that gobbles up all the RAW files from a directory and spits out JPEG (or TIFF or PNG…) files. The interest is that the output quality is very high (including Chromatic Aberration correction and use of 16bits), its usage is flexible (a few variables to configure at the beginning of the script and you’re all set) and it preserves exif data.

A word of caution, though: for CA to work, you need to compile the latest version of Hugin (at least for Ubuntu) and for K users (at least K10) you need the latest version of DCRaw with -S support, otherwise you will get pink highlights (DCRaw with -S support needs to be compiled if you are an Ubuntero).

The script should work with any camera brand, maybe with some adaptation; don’t hesitate to leave comments with your experiments…

Update: get the file

Due to wordpress limitations, the script is enclosed as and ODT file: just open it with OpenOffice, copy and paste it to a text file, save the text file as, make it executable and have fun…

get the raw2any ODT file

10 Responses to Here is a little something for your blog…

  1. Clarke Wixon says:

    Nifty. If I can get this set up how I want it, then I’ll probably stop taking RAW+JPEG all the time. I’ll be able to squeeze more shots onto the memory card between uploads.

    Thanks for passing this on.

    Now to see if I can integrate automatic upload-to-smugmug functionality too . . .

  2. NewMikey says:

    Maybe I am doing something wrong, but I get extremely dull looking results out of this script. Maybe dull is not the word, flat describes it better with muted colors. Gotta play around with the parameters a bit more I guess.

    I use dcraw 8.86 with saturation support. By the way, the script as downloaded has a couple of indentation errors. Just load it into Kwrite or so and fix them. (lines 141 and 158)

    I did do a script like this some time ago (ufrb-kde) based on ufraw’s batch facility. It runs like this one but also from a right-click konqueror menu. I have it tuned to provide identical output to PPL but with better detail.

    All of these batch scripts are extremely handy and useful, once you have set the parameters, they can run through hundreds of RAWs in an hour with great looking results.

    Compliments to the author and a few tips would be welcome.

  3. Michael says:

    Hi fellows!
    Actually, I’m the guy who made up this script… And I very much appreciate your responses here! I hope your feedback will help me improve it. Thanks.

    @NewMikey: pry to comment out -S parameter of dcraw. It might well be that your camera does not require it or the value is too small.

  4. NewMikey says:

    Try adding the following:

    cmd_convert += ” -modulate 150,130,100″

    so the relevant section looks like this:

    cmd_convert += ” -depth 8″ # hint: work in 8bit
    cmd_convert += ” -quality 100″ # JPEG quality, unused for uncompressed formats
    cmd_convert += ” -modulate 150,130,100″
    cmd_convert += ” %s”

    I find it brings the resulting image up quite a bit!

  5. BDion says:

    Hi Joel, Great Blog

    I tried running this script, Thanx Michael, I get indentation errors also on line 141, 154, 167 when I try to fix those I get: (line 168)
    return outdata
    SyntaxError: ‘return’ outside function

    I’m no programer so I not sure what’s up

    # python
    Python 2.5.2 (r252:60911, May 28 2008, 08:35:32)
    [GCC 4.2.4 (Debian 4.2.4-1)] on linux2

    kernel 2.6.25-8.slh.1-sidux-686 #1 SMP PREEMPT


  6. Simone says:

    Hi guys

    I also have problems with the script, tried to fix manually some indentation errors but nonetheless it refuses to run. Could you post a corrrected version?

    Tried the script both on Ubuntu Hardy and PCLOS 2007


  7. jcornuz says:

    Hi there,

    I think the Python -> ODF conversion is the cause of the disaster. You can now download the Python file directly (updated in the blog).

    Take care,


  8. Simone says:


    sorry to bother you again, but tha direct link to the python file doesn’t work 😦


  9. jcornuz says:

    Hi Simone,

    C… OK, I think you should be able to access it now… Sorry for the mess.


  10. Daniel says:

    I didn’t end up liking the results all that much, though with some tweaking here they began to be OK. I had more luck using ufraw-batch. That way I could set up things like curves using a graphical interface and go back and use those settings.

    Thanks for posting the script.

Leave a Reply

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

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

Google photo

You are commenting using your Google 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 )

Connecting to %s

%d bloggers like this: