Sunday, March 12 2006 @ 12:18 PM PST
Contributed by: Richard Pitt
There is, however, a way to get these tools under Windows and I'll get to that later in another part.
In this and later sections, I'll go into more detail, including scripts and references to the actual tools and how to use them.
I use a mixture of shell (BASH) and PERL scripting for much of my day to day things; mostly shell. I'm currently using Red Hat 9 on my main workstation but have the same scripts working on Fedora Core 4 on my laptop. In this segment I'll deal with the various pieces of the puzzle and in another I'll put them all together the way I use them, which should show you have you can do a similar script for the way you want to do things.
Reading the card:
I have a couple of card readers - my original one from Dazzle just reads CF cards but only at the original USB speed of about 12Mbps. The other is/was a 12-in-1 no-name-brand that ran at USB 2.0 (450Mbps) speed but seems to have a problem now :(
Both hook up to a USB port and the operating system should recognize them as storage devices and assign them a device name. Unless you do something strange to them, they'll likely show up as /dev/sdx where the x will be a letter (a, b, c, etc.) and the file system will be a single partition that will be FAT (or FAT32).
You'll have to discover what your system calls your flash-card reader. Mine calls the file system on it /dev/sda1 because I don't have any SCSI drives or other USB storage devices on my system at the moment. I've added a line in my /etc/fstab file for it: (and made the directory /mnt/camera0). In my final script you'll see that I've actually allowed for the device to be called one of several names - because my workstation is always having things added/changed on it.
/dev/sda1 /mnt/camera0 vfat noauto,owner,user 0 0For more information on this incantation you might see the fstab documentation
Once this is done, I can put my card into my reader and type
mount /mnt/camera0and the camera card is mounted and ready for me to copy the files.
At this point, I create a folder/directory in my camera/photos area that has today's date as part of the name.
mkdir ~/camera/photos/2006Mar10If that directory already exists and I don't want to just add more photos to it, I'll append a letter (e.g. 2006Mar10a). Now I can copy the photos from the card to the directory
cd ~/camera/photos/2006Mar10 ; cp -av /mnt/camera0/dcim/100dcim2/* .Don't forget the trailing "." period which means "to here" - Windows' copy command always assumes you mean "to here". Linux makes no such assumption, it always uses the last item (arguement) as where to copy to.
The "cp -av" copies the files and retains the date/time stamp information (and shows you what it is doing - the v part means "verbose"). I'll show you that you may not really need this later as the information is actually inside the file too with most cameras - but for now there's no reason not to keep it.
Once the copy is done, you can erase the images from the card in preparation for its next use.
rm -f /mnt/camera0/dcim/100dcim2/*Then remove the card and put it back into the camera or its carry case.
Dealing with the images:
I usually have my camera set to create a low-res JPG file at the same time it creates the raw (NEF) file. I create a sub directory of the main dated folder called "JPG" and put them in there for reference in case I don't have time to let the workstation create new, high-res ones immediately.
cd ~/camera/photos/2006Mar10 ; mkdir JPG ; mv *.jpg JPGAt this point I can look at the images in the JPG folder and use them to do a first cut at winnowing out the bad ones or picking out the ones I really want to concentrate on. I use gThumb for much of my basic image viewing. It's fairly fast in creating its own thumbnails, and has a built-in cataloging system and the ability to add comments and do some image manipulation to the whole image (color, rotation, etc.) As far as the image manipulation is concerned, I use it mostly to see if an image will "clean up" easily when I use some other tool like GIMP.
Cook some full-res working files
If I'm going to post a contact sheet to my web site or burn a disk for others, I use dcraw to do up a batch of full resolution JPEG files once I've winnowed out the bad ones. Through the use of the shell's piping ability, I can run a couple of commands together and have all the images done in the same fashion.
The basic command for one file is:
dcraw -c -w -g 0.65 dsc_8794.nef | cjpeg -quality 90 > dsc_8794-0.65.jpgWith a little shell magic we can do this for all the original files in the directory:
for file in `ls *.nef | cut -d. -f1` do echo "working on file $.nef" dcraw -c -w -g 0.65 $.nef | cjpeg -quality 90 > $-0.65.jpg doneNext part I'll show you how to put things all together with my modified dcwrap script.