News:

2023-03-15 Major improvements to the new Geolocation feature

Main Menu

Extracting previews from raw files?

Started by chuxter, July 27, 2016, 09:55:14 PM

Previous topic - Next topic

chuxter

I have been using GUI and this command:

-b -previewImage -w name.jpg

It works, but doesn't always extract the same preview [the D810 has 4 previews in it's NEF files]. How do I specify which preview to extract?

Phil Harvey

Good question.

If they have the same name and are stored in a different order in different NEF files, then it is tricky.  (BTW, you shouldn't be using Nikon software to mess with your NEF files like this.)

The only solution would be to create a user-defined tag to pick out the image with the resolution that you want.  See the BigImage tag in the sample config file for a similar user-defined tag that selects the largest preview.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

chuxter

Confused! First, I haven't used any Nikon software to "mess w/ my NEF files". I'm not an idiot! ;-)

I spent hours trying all manner of commands in GUI last evening. I found a "solution" that appears to work; much simpler than that BigImage tag. I'm not sure how to use it in GUI?

When I did "-preview:all", I was shown the 4 files and their sizes in bytes. Each had a name:


  • JpgFromRaw
  • OtherImage
  • PreviewImage
  • ThumbnailTIFF

The names are a bit strange. I assume they happened historically, as raw files started proliferating? Like why not "Preview1"..."Preview4", etc. Or even better "PreviewL"..."PreviewS"! :-) If I was smart and had a lot of time, I guess I could create Custom Tags w/ my preferred names?

When I used those names in this format: "-b -previewimagename -w filename.jpg"

I got the 4 different sizes of preview images. Is this technique not reliable? Does it not always work?

For an example, the preview image extracted w/ "JpgFromRaw" was a full-resolution image w/ the Quality Level about 75% [34:1 compression ratio]. Many people find that usable.

Phil Harvey

Quote from: chuxter on July 28, 2016, 12:10:05 PM
Confused! First, I haven't used any Nikon software to "mess w/ my NEF files". I'm not an idiot! ;-)

This makes me feel better.  I was worried for you because I couldn't think of any other reason why the previewImage would move around in the file.

QuoteWhen I did "-preview:all", I was shown the 4 files and their sizes in bytes. Each had a name:


  • JpgFromRaw
  • OtherImage
  • PreviewImage
  • ThumbnailTIFF

Oh.  So there is only one "PreviewImage" in your file.

I guess I'm back to square one.  I don't understand the problem it seems.  Why do you say that exiftool -previewimage -b doesn't always extract the same preview?  I've got a few D810 NEF samples here, and PreviewImage is always the smallest of the embedded JPEGs:

======== ../testpics/Nikon/D810/D810_MUP_EFCS_OFF.NEF
Jpg From Raw                    : (Binary data 3916666 bytes, use -b option to extract)
Other Image                     : (Binary data 838187 bytes, use -b option to extract)
Preview Image                   : (Binary data 125014 bytes, use -b option to extract)
Thumbnail TIFF                  : (Binary data 57816 bytes, use -b option to extract)
======== ../testpics/Nikon/D810/D810_MUP_EFCS_ON.NEF
Jpg From Raw                    : (Binary data 3877127 bytes, use -b option to extract)
Other Image                     : (Binary data 831363 bytes, use -b option to extract)
Preview Image                   : (Binary data 129255 bytes, use -b option to extract)
Thumbnail TIFF                  : (Binary data 57816 bytes, use -b option to extract)
======== ../testpics/Nikon/D810/firmware1.0.2.nef
Jpg From Raw                    : (Binary data 1843807 bytes, use -b option to extract)
Other Image                     : (Binary data 806947 bytes, use -b option to extract)
Preview Image                   : (Binary data 154462 bytes, use -b option to extract)
Thumbnail TIFF                  : (Binary data 57816 bytes, use -b option to extract)


- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Hayo Baan

Is there a reason you do not use the best quality image that is available, i.e., the jpg from raw?
Hayo Baan – Photography
Web: www.hayobaan.nl

chuxter

When I started trying to extract profiles from NEF files, I Googled and found several articles. I mistakenly got the idea that -PreviewImage and -JpgFromRaw were equivalent tags from readint the articles. I was using them interchangeably. Also, I occasionally wrote -JpegFromRaw and then nothing happened. Not being at all confident what I was doing, I thought exiftool was variable. Sorry for the confusion.

A minor gig: Your documentation didn't help me. The examples [there are only 3] are complex, cryptic, and terse. The descriptions of what each example does is also too short. This example is much too complex for a newbie:

exiftool '-JpgFromRaw<=%d%f_JFR.JPG' -ext NEF -r

It's distinction from:

exiftool -b -JpgFromRaw -w _JFR.JPG -ext NEF -r

Is obscure! I needed this simple example:

exiftool -b -jpegfromraw -w name.jpg

I literally had to try every syntax I could think of to decode how the extraction process was controlled.

BUT, thanks for your help and thanks for a useful utility program! I've got it doing what I want. I had to write my own instructions so I'll remember! :-)

Phil Harvey

Quote from: chuxter on July 28, 2016, 10:42:01 PM
I needed this simple example:

exiftool -b -jpegfromraw -w name.jpg

This is the example that corresponds to this functionality:

       exiftool -b -ThumbnailImage image.jpg > thumbnail.jpg
            Save thumbnail image from "image.jpg" to a file called
            "thumbnail.jpg".


Change -ThumbnailImage to -jpgfromraw and this is the way to extract a single JpgFromRaw to a separate file.  The other examples you showed are more complex because they operate on an entire directory of images.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).