Nikon D40x in Ubuntu Linux
Posted on 06 Nov, 2007, categorized under Information Insemination| Nerd Public Journal?
I’ve been using Nikon D40X on my previous trip to Jakarta (and Bandung). For this I need to update my previous script as there are few differences, as the following:
- I set the camera to use RAW format rather than jpeg
- Data transfer is through the laptop’s built in MMC card slot, rather than USB
- I’m now a (K)Ubuntu user
First step, is the software part. As RAW format is not really usable for "presentation", I need to convert it to another format, say JPEG. For this I’m gonna need ufraw. Let’s install it;
sudo apt-get install ufraw sudo apt-get install gimp-ufraw #optional
Using ufraw-batch (included in the ufraw package), I came up with this self explanatory, lightly commented bash script;
#!/bin/bash
#Set some variables
MOUNT_DIR=/media/mmc
MOUNT_DEV=/dev/mmcblk0p1
PHOTO_DIR=/home/shakir/Photos/temp/D40X
#Copy files from the MMC card
sudo mkdir $MOUNT_DIR
sudo mount -o uid=shakir,gid=shakir $MOUNT_DEV -t vfat $MOUNT_DIR
mv -v /media/mmc/dcim/100nd40x/* $PHOTO_DIR
sudo umount $MOUNT_DIR
sudo rmdir $MOUNT_DIR
cd $PHOTO_DIR
mkdir jpeg
#Convert RAW files to low quality JPEGs
for i in `ls *.nef`; do
ufraw-batch –out-type=jpeg –out-path=jpeg/ \
–compression=70 –size=600,600 –overwrite $i
mv -v $i nef/
done
mkdir nef
mv *.nef nef/
The script would generate a low quality / resolution JPEGs, based on the un-processed RAWs. The JPEGs are useful to actually help me deciding which photos are meant for deletion, and which to keep. Later I would manually go to the selected RAW files folder, and;
ufraw *.nef
to edit the RAW files. This final step would give me the files that I mean to keep;
ufraw-batch --out-type=jpeg --out-path=jpeg/ --compression=100 --overwrite *.nef
I bring back no souvenirs but these photos;





