News:

If this site goes down it is because of the crappy DreamHost web hosting: They will disable your "unlimited traffic" web server if a single bot hammers the site with a moderate load.  If necessary, an alternate ExifTool forum page is available at https://sourceforge.net/p/exiftool/discussion/

Main Menu

extract jpeg from raw (dng) including all metadata

Started by pb, May 01, 2013, 04:26:41 PM

Previous topic - Next topic

pb

It's been a while since I've been monitoring these forums, and since I had to hack exiftool commands...

My initial goal was to extract full res jpegs from NEF files.  Unfortunately, those NEF files (from a scanner) do not contain full res jpegs, so I first converted the NEF files to DNG using Adobe's latest DNG converter.

The DNG files still have all the original metadata, plus stuff Adobe added, which happens to be useful.  Because I specified that I wanted full res jpeg preview when I ran the DNG converter, that's what I got.  (One reason this is a good way to do it is because the Adobe prog takes into account the NEF color settings significantly better than other programs I have tried.)

Now, I have reduced the problem to extracting full res jpeg from DNG.  What I have figured out so far is that I can do the following:

exiftool -b -JpgFromRaw -w jpg -ext dng .
(note the dot -- I am just working in the current dir)

However, doing this for a single file with

exiftool -b -JpgFromRaw anyfile.dng>full_preview.jpg

does not transfer any metadata from the DNG to the jpeg.

So, I also have figured out I can do:

exiftool -tagsfromfile %d%f.dng -ext jpg .

to copy the metadata from the DNG to the jpeg, which seems to work just fine.

My question:  how do I combine those two operations into a single exiftool command, preferably without leaving any intermediate files behind?

Thanks.

--peter

Oh, this is using exiftool 8.87 under win xp.

Phil Harvey

You can't extract an embedded image and copy metadata to it in one step.  You must use 2 commands.  However, you can combine 2 commands into a single command line using the -execute option.

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

pb

Thanks!

Is there any performance advantage to using the execute command?

Never mind;  I found this:

"Also, the -execute option may be used to perform multiple independent operations with a single invocation of exiftool, and together with the -stay_open option provides a method for calling applications to avoid this startup overhead."

Actually, now I have found on the man page the following, which I would like to believe was added only after I asked my original question, but I suspect was there all along:

"exiftool -if '$jpgfromraw' -b -jpgfromraw -w %d%f_%ue.jpg -execute -if '$previewimage' -b -previewimage -w %d%f_%ue.jpg -execute -tagsfromfile @ -srcfile %d%f_%ue.jpg -overwrite_original -common_args --ext jpg DIR

    [Advanced] Extract JpgFromRaw or PreviewImage from all but JPG files in DIR, saving them with file names like image_EXT.jpg, then add all meta information from the original files to the extracted images. Here, the command line is broken into three sections (separated by -execute options), and each is executed as if it were a separate command. The -common_args option causes the --ext jpg DIR arguments to be applied to all three commands, and the -srcfile option allows the extracted JPG image to be the source file for the third command (whereas the RAW files are the source files for the other two commands).'

Phil Harvey

Glad you found that.  No, it wasn't added recently. :)

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