Flutterby™!: raw files and linux

Next unread comment / Catchup all unread comments User Account Info | Logout | XML/Pilot/etc versions | Long version (with comments) | Weblog archives | Site Map | | Browse Topics


This is my first attempt at trying to build a Wiki-like knowledge base on top of the Flutterby content management system.

This is a place for explanation, description and static links on a topic that's either too broad to be covered under a single link, or that you're just too lazy to find the real link to.

Entries are automatically generated.

Converting Canon RAW files to usable images with Linux

by:Dan Lyke [edit history] started: 2003-10-28 18:01:00.265286+01 updated: 2004-09-14 02:48:03.577125+02

On a recent trip to the Sierra, I took a Canon D60[Wiki] body and shot mostly "raw" (ie: CRW) images, from which I derived the pictures at my first quick update and my more picture heavy travelogue. At first I just used dcraw to convert to PPM files, or opened the files directly with the GIMP plug-in and then converted to JPEGs, but I quickly realized that something was missing and I needed to go with deeper color depths and more intelligence in my conversions.

So, after some experiment, here's what I'm doing now:

I use dcraw with the -4 option to build 16 bit per channel PPM files. I convert these to 16 bit per channel TIFF files using ImageMagick. Normally this puts the data in the lower 14 bits of the TIFF file, with ranges from 0 to 16384. The -normalize switch will stretch the contrast range out to the full 0-65535 per channel, with the problem that if you were taking a low contrast scene everything will now be very contrasty. So far I'm willing to live with that as a default.

I also use a -gamma 1.8, which seems to make my first pass at converting that TIFF to a JPEG work fairly nicely.

Further editing can be done with CinePaint, which deals with the 16 bits fairly well, although at this writing, version 0.18.1, there are enough little crashy things that I've signed up for the developer's mailing list and have learned to avoid the "Histogram" feature.

The techniques should also be usable on the Olympus digital camera raw files, although I've only tested that with 8 bit JPEGs.

for exts in .crw .orf
do for f in *$exts ;
    if test -f $f ;
      dcraw -4 $f ;
      bn=`basename $f $exts` ;
      convert -normalize -gamma 1.8 $bn.ppm $bn.tiff ;
      rm $bn.ppm ;
      for s in sm md lg ;
          case $s in
            sm) pct=5 ;;
            md) pct=20 ;;
            lg) pct=50 ;;
          esac ;
        convert -geometry $pct\% $bn.tiff $bn.$s.jpg

Flutterby™ is a trademark claimed by

Dan Lyke
for the web publications at www.flutterby.com and www.flutterby.net.