ExifTool Forum

ExifTool => The "exiftool" Application => Topic started by: C66 on June 25, 2017, 02:53:17 PM

Title: Copying metadata from JPG to DNG files
Post by: C66 on June 25, 2017, 02:53:17 PM
Hi,

I have a new smartphone that saves pictures both as JPG and DNG (i.e. raw) files. I want to work with the DNG files (and develop my final jpg pictures from them). However, the DNG files do not contain all the metadata that I consider relevant, especially, they to do not contain GPS info (geotags); this is only contained in the JPG files (which seems like sub-optimal design to me). Also, the DNG files do not contain any preview or thumbnail pictures (JPG files do).

So I would like to do the following (for all DNG files in a given directory):

(1) copy all relevant (i.e. meaningful) metadata from the corresponding JPG files to the DNG files (corresponding files have the same names, except for file name extensions)

(2) copy preview or thumbnail images from the corresponding JPG to the DNG files

However, I am not sure, how best to do this. Especially, I am not sure which metadata I should copy. Obviously, some of the metadata for the DNG file must remain unchanged, or would not make sense if copied from the JPG file. (For example, the DNG and JPG files do not seem to have the same resolution.)

Also, I am not sure, whether thumbnail pictures can be copied at all.

Using Exiftool, I have extracted all metadata from a sample JPG file and the corresponding DNG file.

The results are shown in the attached files. As these show, the DNG file only contain tags in the IFD0 group, while the JPG file also contains tags in the ExifIFD, InteropIFD, GPS, IFD1 and JFIF groups.

Would it make sense to copy all tags of the latter groups (i.e. other than IFD0) from JPG to DNG files? And how exactly would I do this?

I have tried something like this:

exiftool -m            -tagsfromfile "%%d%%f.JPG" -thumbnailimage -ext DNG "D:\mydir"
exiftool -m -exif:all= -tagsfromfile "%%d%%f.JPG" -exif:all -gps  -ext DNG "D:\mydir"


Copying the metadata (such as GPS info) seems to work in principle, but copying thumbnail images does not work like this.

So, I wonder whether you could suggest a solution to copy the "right" metadata and, if possible, the thumbnail images from JPG files to corresponding DNG files.

Any help will be greatly appreciated.

Claus
Title: Re: Copying metadata from JPG to DNG files
Post by: Phil Harvey on June 25, 2017, 03:42:38 PM
Copying the metadata from the GPS and ExifIFD to the DNG is relatively safe, but I would be careful with the others.  I don't think a JPEG thumbnail is compatible with DNG.  There will be some metadata tags in IFD0 that you can copy with the CommonIFD0 tag, but you shouldn't mess with the others.

So I would recommend this:

exiftool -tagsfromfile "%%d%%f.JPG" -gps:all -exififd:all -commonIFD0 -ext DNG "D:\mydir"

And you might want to add -makernotes to this command to also copy the maker notes if they exist.

- Phil