17

I accidentally set my camera (a Nikon D70) to shoot in NEF only and not NEF+JPEG.

Obviously, this will be a major pain when I want to go through them all. I don't envy having to wait for seconds at a time for a single picture to render.

Is there any way I can batch convert the whole set (thousands of pictures) to JPEGs?

I am running Windows 7 and Xubuntu 12.04.

2
  • 1
    You probably got a copy of View NX2 (you can download from the Nikon site) with your camera - that will batch convert and do it in a similar way to in camera conversion
    – BJ292
    Apr 20, 2013 at 17:51
  • On my mac, ViewNX2 crashes randomly when batch converting NEFs to JPGs. Worse, you cannot restart from where it last crashed. Also, ViewNX2 development has been stopped and Nikon has developed a new tool Capture NX-D - I've not used it yet but I'd be cautious using it for large batch conversions.
    – Regmi
    Jan 18, 2016 at 5:37

7 Answers 7

10

Another great free tool is IrfanView that when combined with plugins can Batch convert from almost any format to JPG.

Q: Can I use IrfanView on Linux?

A: Yes. There is no native-Linux version of IrfanView. However, you can use IrfanView in conjunction with Linux programs like WINE, Windows Linux emulators and Linux-based virtual machines. Take the ZIP version of IrfanView and unzip it or copy your existing Windows IrfanView folder to Linux. This is easier because the installer may need additional Windows DLLs to run.

If you want a software that is more OS independent then I would recommend UFRaw. Use it either on its own or in conjunction with Gimp

3
  • I think this is a better solution then mine, IrfanView can do a lot more than these conversions.
    – galuano1
    Apr 4, 2013 at 0:43
  • 2
    Well, that's up to OP to judge :)
    – Darius
    Apr 4, 2013 at 0:44
  • IrfanView 4.57 with installed plugins is unable to open NEF from Nikon D800 on Ubuntu 20.10. It's too bad because I've been using IrfanView on Windows for years.
    – expert
    Mar 30, 2021 at 18:51
28

One solution, on Ubuntu, would be to use dcraw to convert NEF to PBM, and pnmtopng to convert PBM to png. So, open a terminal and run these commands:

sudo apt-get install netpbm dcraw

I don't have any .NEF images to test this, but according to this page, you can do:

Convert all NEF images to PNG:

dcraw -c -w input.NEF | pnmtopng > output.png

To convert an entire directory:

for filename in *.NEF ; do dcraw -c -w "$filename" | pnmtopng > "$filename.png" ; done

Probably the best tool around for all your batch image processing needs, however, is ImageMagick. It's free, open source, cross platform and can do just about everything you can think of including resizing, cropping, managing transparancy, montage and converting between most image formats under the sun. It would have been my first choice, but I found some (older) posts claiming that it did not work with NEF. Still, their website says it does, so you should try it out and in any case, it is really worth learning. Install it on Ubuntu with:

sudo apt-get install imagemagick

To convert a single .NEF:

convert foo.NEF foo.jpg

To convert all .NEF files in the current directory (will overwrite the originals):

mogrify -format jpg *.NEF

To do the same but keeping the original files, run convert in a loop:

for img in *.NEF; do convert "$img" "$img.jpg"; done
6
  • 4
    You might need to install ufraw-batch first. (I had to sudo apt-get install ufraw-batch to make mogrify work)
    – Clash
    Sep 26, 2013 at 19:42
  • 4
    Oh and mogrify -format jpg *.NEF does not overwrite the originals
    – Clash
    Sep 26, 2013 at 19:50
  • This is great! If I want to run "mogrify -format jpg *.NEF" also for NEFs in subdirectories, how would the bash script look like? Thanks.
    – Regmi
    Oct 19, 2013 at 22:56
  • 2
    @Regmi try find . -name "*.NEF" -exec mogrify -format jpg {} +.
    – terdon
    Oct 21, 2013 at 14:26
  • Thank you this is exactly what I was looking for, I didn't want to have to install WINE in addition to some windows program! Just wanted to run it as a single command the linux way. Thanks again!
    – xamox
    Nov 28, 2014 at 18:45
11

If you do end up using ImageMagick, then I recommend using xargs if you've actually got thousands of images to convert rather than using a for loop. That way, you can easily bump up the parallelism:

# Runs these conversions serially
ls *.NEF | sed 's#.NEF##' | xargs -I^ convert ^.NEF ^.jpg

# Runs these conversions with 8 different processes
ls *.NEF | sed 's#.NEF##' | xargs -P8 -I^ convert ^.NEF ^.jpg
3

Using GNU Parallel:

parallel convert {} {.}.jpg ::: *NEF

Deals correctly with filenames containing ', " and space.

2

You can use NEFtoJPG. Its free and can do batch processing.

4
  • Unfortunately it's for Windows only May 4, 2016 at 10:36
  • @NickolayKondratenko How about Wine?
    – galuano1
    May 4, 2016 at 12:43
  • 1
    If to choose between native app and wine I'd choose native one May 4, 2016 at 13:09
  • It's very very very slow.
    – expert
    Mar 30, 2021 at 18:54
2

This answer was given by alexpotato and dawid-drozd at Unix & Linux to Converting .NEF to .JPG. It is not my own solution. Please give the credit to them.

The program ufraw-batch does the job. After installing the program, do:

ufraw-batch --out-type jpeg *
0

i know this is a old question but recently Nikon released a free version of

Nikon Capture NX-D

imho the best way to go

2
  • 340MB for a converter?! That's insane.
    – expert
    Mar 30, 2021 at 18:55
  • It's more powerful than just converting and the result has excellent quality (compared to irfanview with plugin)
    – fubo
    Mar 31, 2021 at 5:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .