[Solved] Fast raw to jpg?


(gogoigo) #1

I start to use raw (NEF) files recently. I would like process it in batch mode for have a preview of each photo. I don’t want quality in these jpg.
I use: rawtherapee -p autoLevel-Resize900.pp3 -c files.NEF
But in my (old) computer takes around 20 seconds each image. I tried imagemagic but it takes similar time.
Thanks.

Edit: I’m looking for a solution for linux

Edit: Best solution for my problem:

exiftool -b -PreviewImage -w _preview.jpg -ext NEF -r ./

#2

Hello,
I used IrfanView last time with the NEF plugin.
See http://www.techishare.com/tech/how-to-view-and-convert-nef-image-files/
I cannot comment on the time it took to convert over 2000 pictures :slight_smile:


(gogoigo) #3

I forgot say for linux :frowning: but if someday i use windows, i will try it. thanks


(Karl) #4

Does your preview have to be a specific size? If not, you could just extract the embedded JPEGs from the NEF files with exiftool. Something like this maybe?

exiftool -b -PreviewImage -w _preview.jpg -ext NEF -r ./

(edit - if they are too small, you could use ImageMagick to scale them to a larger size, which would likely be faster than processing the raw image data.)


(Alberto) #5

dcraw -e will extract the embedded “thumbnail” (which iirc on nef files is full size actually). if you use geeqie as a viewer, you can open raws directly and the embedded JPEG will be shown


(Glenn Butcher) #6

Shameless promotion for the command line program that comes with rawproc: img (yes, I’m not an imaginative namer, ask my son, Son…:smiley: )

For linux, you’d have to compile it right now; I might be able to make an AppImage in a couple of days. Here’s a run on my quad-core AMD desktop:

glenn@caliente:~/ImageStuff/rawproc/build$ img DSG_3111.NEF gamma:2.2 blackwhitepoint resize:640,0 sharpen:1 test.jpg
1: Loading file DSG_3111.NEF ... done. (3.505898sec)
Image size: 4948x3280
Orientation: 0
gamma: 2.20 (4 threads)... done (0.805819sec).
blackwhitepoint: 61.00,181.00 (4 threads)... done (0.451415sec).
resize: 640x424 (4 threads)... done (0.401470sec).
sharp: 1.00 (4 threads)... done (0.007512sec).
Saving file test.jpg ... done. (0.041527sec)

Instead of compiling rawproc, the command line program is also in the image library, gimage, named gimg (yes, I know…)

Edit: Okay, making an AppImage of it wasn’t that hard. It’s posted in the github releases page, as img-x86_64.AppImage:

https://github.com/butcherg/rawproc/releases/download/0.6.1/img-x86_64.AppImage

You have to use absolute paths for the input and output images, but it seems to work okay.


(gogoigo) #7

Nice! I didn’t know that raw file have an embedded jpg
It’s very fast!


(gogoigo) #8

I just tried dcraw but it doesn’t extract the thumbnail,
man dcraw: -e Extract embedded thumbnail image

but I exec “dcraw -e DSC_0145.NEF” and the result is DSC_0145.thumb.jpg but the size is 2MB and 4608x3072px


(gogoigo) #9

I would try compile it when I have time, thanks


#10

I know this is marked as solved, but there is a version of XnViewMP for linux.

It might/might not read your raw files, and might/might not be quicker since much depends on your computer.

It can create a jpeg contact sheet of images. Here it takes about one second to generate its own thumbnails when opening a directory. Then the same again to generate the contact sheet.

An example looks like this, https://i.imgur.com/D1eAZG5.jpg and this https://i.imgur.com/Ui9tjv6.jpg


#11

@gogoigo If you like exiftool, there is much more you can do with it. E.g.:

exiftool -b -JpgFromRaw -w _JFR.JPG -ext NEF -r .
Recursively extract JPG image from all Nikon NEF files in the current directory, adding _JFR.JPG for the name of the output JPG files.

exiftool -a -b -W %d%f_%t%-c.%s -preview:all dir
Extract all types of preview images (ThumbnailImage, PreviewImage, JpgFromRaw, etc.) from files in directory “dir”, adding the tag name to the output preview image file names.

Documentation: https://www.sno.phy.queensu.ca/~phil/exiftool/#links


dcraw -e does in fact extract an embedded image, just not one that you may want.

Try doing exiftool -a -b -W %d%f_%t%-c.%s -preview:all dir from above. It may extract multiple embedded images. In my case, there are two resultant files: one with _PreviewImage appended to the filename and the other with _ThumbnailImage. dcraw -e only extracts the former.

The appended labels are actually tags; so if you prefer the _ThumbnailImage embeds, try doing exiftool -b -ThumbnailImage -w _JFR.JPG -ext NEF -r .. Notice how I replaced -JpgFromRaw.


PS exiv2 is an alternative to exiftool if you would like to explore more options.
PPS I forgot to mention that not all embedded images are necessarily JPG files! So make sure that you remember to change the file naming to reflect the file type.


Recovering corrupted .nef files
(gogoigo) #12

Thanks for your answer, XnViewMP is not free software, so I will avoid it when it’s possible :frowning:


(gogoigo) #13

thanks for the explanation :slight_smile:


(Mike Bing) #14

So? You have your thumbnail which is at full dimensions but rather high compression. What are you missing?


(Nicolas) #15

A little off-topic but why don’t you shoot in raw+jpg ?


(gogoigo) #16

Some handicaps are:

  • More process for the camera.
  • More space (around 6MB on 14mpx), a thumbnail can be 100kB.

I’m newbie, so I’m sure there are advanges and handicaps. Perhaps we could open a new thread for this topic.


#17

I did not know you intended commercial use where a licence is required.

Just so everyone knows, XnViewMP is free for personal use.


(gogoigo) #18

it’s a personal preference, I prefer use free software.


(Roger) #19

I’m in your same boat with open source software.

With RAW images, RAW images are meant more for adjusting the image file’s apparence and gaining every last bit of detail. Interestingly with the NEF RAW file format, the NEF format usually embeds a ~2MB JPEG, and is very similar in detail/comparison to the larger ~10MB FINE JPEG file. (Try a side by side comparison for yourself, you’ll likely see very little difference!)

Rather than batch convert RAW NEF files to TIFF or JPEG, I (batch) extracted the JPEG using exiftool.

I’ve recently switched within the past months from always using the NEF RAW format for all photos. I now use the following tactic:

  1. Only using the NEF RAW fomat for “Oh my God” great looking cat images and other precious photos and/or still photos. Sometimes in tandem with the X-Rite ColorChecker Passport or other grey shade cards, time permitting.

  2. “JPEG only” format for the remainder of my photos, such as images of my property or images for my photo journal. JPEG only mode is also supposedly better for fast paced action such as aircraft. (5 to 10+ series of fast paced images is usually a lot for a small digital camera to handle.) If you’re always sharing images, JPEG is more commonly shared.

NOTE: It is very difficult to remember to switch image file formats prior to taking images. I get some inadvertent RAW or JPEG formats, when intending to acquire usbing the opposite format.

I still prefer TIFF for archiving, but TIFF is likely being squeezed-out by RAW and JPEG, as RAW acts more like a negative and JPEG being more social. Literally squeezed-out due to it’s enormous 10-12 bit color file size!