/home/shakir

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;







Looking for something else? Search Google.

13 Responses to "Nikon D40x in Ubuntu Linux"

1 | Yoon Kit

November 6th, 2007 at 12:46 pm

Avatar

These are great pictures!

You sure the “Telnet” wasnt manipulated?

yk.

2 | shakir

November 6th, 2007 at 12:54 pm

Avatar

The telnet image now links to a closer view of it, which in a way yes, seems manipulated, but not digitally :). These were taken while I was traveling, in car, so sorry for the quality..

4 | shakir

November 7th, 2007 at 7:30 am

Avatar

Wah Mr Peja, follow blog Pak Budi ke? :)

Yup, was at Indonesia for BCS07, and for the visit too.

5 | chfl4gs_

November 7th, 2007 at 11:39 am

Avatar

BSD City?!! wow… hahahaha. nice one.

6 | peja

November 8th, 2007 at 9:09 am

Avatar

Lama dah follow!!..blog Pak Budi Rahardjo sempoii..
amacam cewek2 Bandoeng?..hhaha..I was there (ITB)last year for Nanotech Events & UKM-ITB-LIPI Collaboration

7 | shakir

November 9th, 2007 at 7:48 am

Avatar

chfl4gs_: Too bad that BSD stands for something that I couldn’t even understand what the taxi driver was explaining, and it’s not at all a geek’s city of some sort :(

peja: Yup, a sempoi one (a rock star too he is, rite? hehe). I just heard ITB is a good place, and we did have drive around the campus while we were there. Too crowded :D

8 | Régis B.

December 27th, 2007 at 7:53 pm

Avatar

I discovered your blog entry while I was looking for a way to convert my neffiles from my d40x to an “easier” format. After several tests, I realised the output of the ufraw command could be greatly improved by setting the –saturation and –gamma options manually. The results of my experiences is that “–saturation=1.6 –gamma=0.25″ are the parameters that work best, i.e: the output is the closest I could get of the jpeg files that the camera creates when it is set to RAW+low res JPEG.

What do you think?

9 | sudopeople

January 3rd, 2008 at 8:03 am

Avatar

Your script has helped me out a lot, thanks for sharing.

My thoughts:

Why does it mount your drive? Both the camera and the card itself automount in Dapper+
Why does your script move each .nef in the loop then move all again at the end?
My D40x names the images .NEF on my card not .nef I wonder why yours does them in lowercase…maybe it’s a fat32 filesystem thing with my drive. (I use a Micro SD so I can use my tiny USB card reader)

Thanks again! + I lolled @ your shots

Tiny Card Reader
http://usb.brando.com.hk/prod_detail.php?prod_id=00331

10 | shakir

January 3rd, 2008 at 8:31 am

Avatar

Régis B.: I’ll look into that and post on it here.
sudopeople: I don’t like automount and so I disabled it :D I’m into improving this post + script and would probably come out with a new post about it..

11 | Linux und das RAW-Format | bernd-distler.net

January 13th, 2008 at 11:33 pm

Avatar

[...] So schnell kann es gehen. Hier habe ich die Lösung mit ufraw schon gefunden. Einfach das Paket installieren (befindet sich in [...]

12 | Regis B.

January 19th, 2008 at 7:14 pm

Avatar

I realised the output of ufraw was not close enough with the JPG output of the d40x, whatever the options of ufraw were. After much tattering and testing and googling, the only correct and free solution was to install IrfanView (http://www.irfanview.com/) with the latest plugins installed and to use the program with Wine.
I know, this solution is not really rewarding intellectually speaking, and if you got anything better please let me know.

13 | shakir

January 19th, 2008 at 8:43 pm

Avatar

@Regis B: I get .ppm files after saving the edited .nef while opening it with ufraw. I later use ppmtojpeg to convert the .ppm to jpeg format. Using ufraw-batch as in my post would give jpegs of unprocessed raw/nef, which surely is nothing not comparable to the JPG output of d40x.. I promised to blog again about this (some fixes, and a functional, interctive script, but then, I’m still trying to squeeze my time for it..

Comment Form


  • si perda: wah.. boleh kasi need for speed test power skali... boleh layan network race ni...
  • Faiz: wah....harganya berapa?
  • shakir: Hmm, I have no lab and that actually was my living room :D Sure I'll move them to one of my available rooms at home and make it a lab, but that'll be
  • peja: whoaaa..at least u have ur own lab...look interesting!
  • Qing Ru: He looks really cute! Fatherhood must have been quite rewarding :)
  • shakir: Chris: Thanks, I've updated the post.
  • shakir: tak cukup banyak guinea pig yang dah try and comment on the wimax service, and so I'll just wait :D
  • shakir: Vadim: Yup, but I prefer to just install dosbox and play the game rather than re-installing my system with 32 bit Linux :D
  • Vadim: 2shakir: wine doesn't support 64-bit linux. You have to use 32-bit linux if you want to use wine.
  • kevler: yerp ...dalam 2 hari nih jer ..aku dah kesan 2 BMW X6 , kat puchong dan jalan ampang ..giler laa lawa



Disclaimer

The information in this weblog is provided "AS IS" with no warranties, and confers no rights. This weblog does not represent the thoughts, intentions, plans or strategies of my employer. It is solely my own personal opinion. Inappropriate comments will be deleted at the authors discretion. All code samples (if any, ever) are provided "AS IS" without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular purpose.
Personal (Blogs) - TOP.ORG