copying metadata from PEF to DNG invalidates preview image

Started by bgabrhelik, October 21, 2010, 06:03:50 PM

Previous topic - Next topic

bgabrhelik

Hello,

I have converted PEF RAW files (Pentax K-x) into DNG with aid of Pentax Digital Camera Utility 4 (PDCU4). After that I tried to copy metadata from PEF files to DNG files by command:

exiftool -tagsFromFile "../PEF/%d/%f.PEF" -r -ext DNG .

I noticed that there is a worse "preview" image quality in applications.

After some observation I realized that the original PEFs and DNGs contain three "preview" JPEG images.

-ThumbnailImage
-PreviewImage (640x480)
-JpgFromRaw (full CCD resolution JPG)

I am not able to extract -ThumbnailImage and -JpgFromRaw image from modified DNG files. But it seem that JPEG data are there, because PhotoMe shows metadata for Image, Additional image(1) and  Additional image(2).

I exported metadata into xml file (-X option) and compared XML files. I didn't see big differences.

What am I doing wrong? Should I just copy some subset of metadata, like Camera settings? Can I somehow specify the XML tags to copy from command line? e.g. <IFD0:Artist>. Note that I would prefer way without intermediate file(s).

Thanks,
Bronislav

P.S. I can provide samples if they are needed.

Phil Harvey

Hi Bronislav,

You may need to do some testing to see what works with your software, but you could try something this since you don't want to overwrite the previewimage or jpgfromraw of the DNG image:

exiftool -tagsfromfile a.pef --previewimage --jpgfromraw a.dng

There are many, many different ways to specify which tags to copy.  In your example, you could just put -ifd0:artist after the -tagsfromfile a.pef to copy only the Artist tag from IFD0 in the PEF to IFD0 in the DNG.  But specifying individual tags can be painful because there may be so many.  It is easier to copy groups of tags.  If I wanted to do what you are doing, I would probably do something more like this:

exiftool -tagsfromfile a.pef -@ exif2xmp.args -makernotes a.dng

This uses the "exif2xmp.args" file (available in the full exiftool distribution) to populate the standard XMP tags from EXIF, and copies the makernotes to keep all of the camera-specific information.  On top of this, you can add any EXIF tags you want to populate (like -EXIF:Artist) to the command.

Have fun.  There are a world of possibilities!

- 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 ($).

bgabrhelik

Phil,

I appreciate your help. Thank you! I will try your hints later at home.

It is amazing how great tool is exiftool. So many file/metadata formats supported! I am a SW developer and I can hardly imagine how one man can handle it. Not speaking about supporting of this orum.

Exiftool helped me easily fix dates on modified files. Now I have a "dropbox" directory from which exiftool moves file into proper directory structure based on picture dates....

Again, thanks
Bronislav