ExifTool Forum

ExifTool => The "exiftool" Application => Topic started by: M on November 09, 2014, 11:18:23 AM

Title: DNG validation hash to file name
Post by: M on November 09, 2014, 11:18:23 AM
I only use raw files and I convert everything to DNG. In these DNG files there's a validation hash in md5 format (http://www.dpbestflow.org/data-validation/dng-validation (http://www.dpbestflow.org/data-validation/dng-validation)) automatically generated and embedded for the image part of the file.

I currently use this format for my filenames: 20141109_171220_00.DNG.
It's capture date and time and the last two digits are only changed if more than one image has been taken the same second.

I would like to have the md5 checksum appended to the filename, like so:
20141109_171220_00_23e2847712a40e1bd0404115e1c512c2.DNG

Usually when I post photos to my website or give them to a client I don't want to include the date and exact time in the filename. That means I come up with something descriptive words for a file name. Later, by looking at that descriptive file name, I can't find it in my own collections. Embedded XMP metadata doesn't always help as that is sometimes stripped. Instead I would like to use 23e2847712a40e1bd0404115e1c512c2.JPG (the DNG files are obviously to JPEG before uploading) for my website.

Is there a way to extract the DNG checksum with exiftool? This would be freaking awesome. I realize that MD5 collisions are technically possible, but they will be few and I will probably be able to find the file among a few collisions.
Title: Re: DNG validation hash to file name
Post by: Phil Harvey on November 09, 2014, 12:43:23 PM
ExifTool can rename the file using any metadata in the file.

- Phil
Title: Re: DNG validation hash to file name
Post by: StarGeek on November 09, 2014, 05:45:24 PM
I grabbed a couple DNGs off the web and RawDataUniqueID might be the tag you're looking for.  If that's the tag, then your command might looks something like:

exiftool "-filename<%f_${RawDataUniqueID}.%e" <DIR/FILES>
Title: Re: DNG validation hash to file name
Post by: M on November 10, 2014, 06:16:33 AM
Quote from: StarGeek on November 09, 2014, 05:45:24 PM
I grabbed a couple DNGs off the web and RawDataUniqueID might be the tag you're looking for.  If that's the tag, then your command might looks something like:

exiftool "-filename<%f_${RawDataUniqueID}.%e" <DIR/FILES>
Hi there! Thanks a lot. This helped me research further.
According to http://www.barrypearson.co.uk/articles/dng/specification.htm "NewRawImageDigest" is the MD5 digest and was introduced in DNG 1.2.0.0 while "RawDataUniqueID" was introduced in 1.1.0.0 and seems to be another checksum of some sorts.
There also seems to be a ImageUniqueID available in some other raw formats (not sure which ones). Perhaps this could be a solution if you don't want to convert to DNG.
Title: Re: DNG validation hash to file name
Post by: M on November 10, 2014, 11:54:05 AM
OK, I realize that this next question is Lightroom related. But perhaps someone has run into the same problem.

My problem is that the files I want to change the name for are in a Lightroom catalog. Edit history (among a few other things) is not included in the XMP metadata in the DNG file, but only in the catalog. I'd like to change the name of the files with exiftool but still retain edit history.

Ideas?
Title: Re: DNG validation hash to file name
Post by: Hayo Baan on November 10, 2014, 01:27:41 PM
Hi M,

As you're using dng, I think this can be achieved by updating the embedded metadata of these files explicitly (right click, choose metadata update, perhaps also update the embedded preview as that will allow you to see your edits outside LR too). If this doesn't work, then there is no other way than to only use LR when renaming files (not nice, I know).

HTH,
Hayo