for /f “tokens=*” %x in (‘dir /b *.nef’) do dcraw -e %x

Sorry, being a total geek here.

If you are also a command line geek you will look at the above and go Ahhhh…

Otherwise, it means nothing and you can skip over this post.  🙂

For the rest of you — the above “converts” NEF files into JPG faster than anything you have ever seen before.

And is great for converting 250 NEF files you snapped of something totally unimportant that should have been shot in jpg and not raw.

For example: we visited a couple of flats/apartments this weekend (thinking about moving) and I put a Sigma 10-20mm Best of the Best 4: Without Warning hd on my D300 and walked around shooting absolutely everything.  The idea was that once we got home if we thought “hey, was there an xyz in the whatever room of that second one” or something like that we could jsut refer to the images rather than go back or phone and ask.  So to cover everything, even at super wide, I was shooting like crazy.  Barely aiming, not bothering to focus (and that lens managed fine actually, very well for this purpose).

But I got home and found I had 250+ raw files — or almost 4G of data!  Drat, should have switched to jpg for these snapshots, but now what do I do?  Sure I can batch them through ACR or photoshop, but it’ll take forever.

So luckily I had just been looking at dcraw, the command line raw processor recently, I had the Windows build, and tada.

for /f "tokens=*" %x in ('dir /b *.nef') do dcraw -e %x

An command line that takes all the raw files in the directory and spits out jpg files instead.  After that I just del *.nef and I’m done.

Up side:

  • Fast
  • No settings to worry about
  • Fast
  • Did I mention fast?  We are talking less than a second an image.

Downside:

  • It isn’t really converting the raw fileof course, it is merely extracting the basic Jpeg that is embedded in the raw file.  But that’s “good enough” for what I wanted.

Still a good trick and to save me having to think about the syntax next time I have to do this I’m blogging about it so I can go back and refer to my own blog.  I knew there was a reason I was blogging!

And of course now that I know dcraw can do this I’ll be looking to integrate raw preview into Camera Control using this.  In my copious free time!  Huh!

PS.  There should have been a video today about how to do the paper grid spot, but I totally messed up the recordings and all the files are a disaster so this too will have to wait for another time.

4 Replies to “for /f “tokens=*” %x in (‘dir /b *.nef’) do dcraw -e %x”


  1. Notice: Only variables should be assigned by reference in /home/diyphoto/public_html/wp-content/plugins/subscribe-to-comments/subscribe-to-comments.php on line 591
    Peter S says:

    You can do the same with exiftools. There are a both a thumbnail jpeg and a preview jpeg inside all Nikon NEFs. It might even be faster, I don’t know 🙂


  2. Notice: Only variables should be assigned by reference in /home/diyphoto/public_html/wp-content/plugins/subscribe-to-comments/subscribe-to-comments.php on line 591
    James says:

    say i wanted to convert all nefs in my documents how would i do it


  3. Notice: Only variables should be assigned by reference in /home/diyphoto/public_html/wp-content/plugins/subscribe-to-comments/subscribe-to-comments.php on line 591
    Nathan deGargoyle says:

    Firstly I’ve just downloaded camera control and I am going to have so much fun with this (although you need a more obvious “how to” link for those of us who know more about cameras than we do about computers. It comes across as pretty scary!)

    Secondly Irfanview has a great batch convert option which works well for .nefss


  4. Notice: Only variables should be assigned by reference in /home/diyphoto/public_html/wp-content/plugins/subscribe-to-comments/subscribe-to-comments.php on line 591
    Nathan deGargoyle says:

    irstly I’ve just downloaded camera control and I am going to have so much fun with this (although you need a more obvious “how to” link for those of us who know more about cameras than we do about computers. It comes across as pretty scary!)

    Secondly Irfanview has a great batch convert option which works well for .nefs


Deprecated: Function get_currentuserinfo is deprecated since version 4.5.0! Use wp_get_current_user() instead. in /home/diyphoto/public_html/wp-includes/functions.php on line 6114

Leave a Reply

Your email address will not be published. Required fields are marked *