Nils Pickert Published on May 22, 2008
by Nils Pickertpro

Nils Pickert's blog

Browse posts
Anniversary
Posted on June 19, 2008
4 comments (latest 5 months ago)
Le Français modern
Posted on June 15, 2008
2 comments (latest 5 months ago)
Bruce Schneier: The war on photography / Photographer's Rights
Posted on June 7, 2008
4 comments (latest 4 months ago)
Digital Forensics
Posted on June 3rd, 2008
1 comment (latest 3 months ago)
Raw Conversion
7 comments (latest 5 months ago)
Flood of pictures
Posted on May 19, 2008
7 comments (latest 5 months ago)
Blues Vader
Posted on May 14, 2008
1 comment (latest 6 months ago)
Visitor 12345
Posted on April 18, 2008
What if one of them seems odd? - or - The end of photography
Posted on March 5, 2008
2 comments (latest 8 months ago)

Member tags

sab
Beteigeuze

More information

This post is public
© All rights reserved
  1. 541 visits

Raw Conversion

Thursday May 22, 2008 at 12:36PM

As Beteigeuze asked, here is my script I used for RAW processing (right now I convert the RAWs manually in f-spot with ufraw)

#!/bin/bash
# Converts all Raw-Files in a dir to jpeg with dcraw
# needs ExifTool available from www.sno.phy.queensu.ca/~phil/exiftool

set -e
ext=.CRW

for i in *$ext; do
# Get basename of file for easier treatment
bn=`basename $i $ext` ;
#
# Convert from RAW
#
# Check if a jpg already exists
if [ -f ${bn}.jpg ]; then
    echo "File $bn already converted"
else
    echo "Converting File $bn"

## Method 1: just use dcraw
    # converts directly to jpg without any treatment
    #   dcraw -a -c $i | ppmtojpeg > ${bn}.jpg;

## Method 2:
    # This should do some basic image treatment:
      # dcraw -a -4 $i ;
      # convert -normalize -gamma 1.8 ${bn}.ppm ${bn}_dcraw4_normalized.jpg ;
      # rm $bn.ppm;

## Method 3: 
    # Including an ICC profile, this gives the best results for my screen
      dcraw -4 -c -w -m $i | pnmnorm -bpercent 0.1 -wpercent 0.1 -brightmax \
        | pnmtotiff -truecolor >temp.tif;
     tifficc -w -i ~nils/eos10d-linear-8apr2004.icc temp.tif ${bn}.tif;
     convert -quality 90 ${bn}.tif ${bn}.jpg ;
      rm $bn.tif ;
      rm temp.tif;
#
# Copy and set EXIF stuff
#
    ~/Image-ExifTool-6.81/exiftool -TagsFromFile $i ${bn}.jpg;
    ~/Image-ExifTool-6.81/exiftool -Author="Nils Pickert" -OwnerName="Nils Pickert" -UserComment="(c) Nils Pickert" $bn.jpg;
    rm $bn.jpg_original;
#
# rotate according to EXIF
# this is only necessary for method 1 and 2, not for 3
    #  exiftran -i -a ${bn}_dcraw_only.jpg;
fi
done

7 Comments / add your comment?

Doomshammer pro says:
I suggest to use s. th. similar to "ls -1 *.$ext | while read i; do .... done" for the loop. Otherwise you may run into issues with files that have a whitespace in the filename.
Posted 6 months ago. ( permalink )
Nils Pickert pro replies:
Good point. But as I take the pictures directly from the camera, they still are in the format CRW_####.crw :-)

But for anybody else who might use this, this is a good recommendation!

--
Seen in a user home page (?)
Posted 6 months ago. ( permalink )
Roberto Ballerini - traveling pro says:
EOS 350D uses the .CR2 extension, so ext=.CR* will convert them too

--
Seen in robertoballerini home page (?)
Posted 6 months ago. ( permalink )
Nils Pickert pro replies:
Unfortunately I only own a 300D. :-) I hope to have to adapt the script for a 40D soon... ;-)
Posted 6 months ago. ( permalink )
Tanja Benitsch pro replies:
Klingt gut, krieg ich dann die 300D? ;)
Posted 6 months ago. ( permalink / translate )
Beteigeuze says:
Hey Nils, dank dir für des Script ... damit sollte des alles nett leichter gehen -.-
Jetzt heißt es nur noch n optimales Setting zu erstellen, und dann gehts los *g*
Posted 6 months ago. ( permalink / translate )
Nuno Castro pro says:
Obrigado pela script. Hei-de experimentar da próxima vez que tirar fotos em raw.
Posted 5 months ago. ( permalink / translate )

Add your comment

Reply to this comment

Edit your comment

Please sign in to post a comment Sign in now?


rss Latest comments – Subscribe to the feed of this post comments.